Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrschnekenbu2010-12-09 13:11:36 +0000
committerrschnekenbu2010-12-09 13:11:36 +0000
commit6b727cdfa9297e7d0f52c1e22a09c1322b3b710c (patch)
treed49f9fc643beb45bfa506f097742ead8919430e4 /plugins/core
parent204499c88d7e70cec7308749019efdd93c2b3028 (diff)
downloadorg.eclipse.papyrus-6b727cdfa9297e7d0f52c1e22a09c1322b3b710c.tar.gz
org.eclipse.papyrus-6b727cdfa9297e7d0f52c1e22a09c1322b3b710c.tar.xz
org.eclipse.papyrus-6b727cdfa9297e7d0f52c1e22a09c1322b3b710c.zip
Merged branch 0.7.X changes r2480:3444 into the trunk
Diffstat (limited to 'plugins/core')
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode.history/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode.history/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode.history/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode.history/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/CollaborativeActionsFactory.java21
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.emf/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.emf/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SemanticFromGMFElement.java44
-rw-r--r--plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java72
-rw-r--r--plugins/core/org.eclipse.papyrus.core.feature/feature.xml2
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/build.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.core.resourceloading/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.core/.classpath2
-rw-r--r--plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF4
-rw-r--r--plugins/core/org.eclipse.papyrus.core/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.core/build.properties8
-rw-r--r--plugins/core/org.eclipse.papyrus.core/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/IElementWithSemantic.java31
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/contentoutline/ContentOutlineRegistry.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java109
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/ui/IRevealSemanticElement.java30
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/PapyrusEcoreUtils.java86
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/ValidationUtils.java78
-rw-r--r--plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java61
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEvent.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEventListener.java57
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/LifeCycleEventsProviderTest.java232
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/SaveAndDirtyServiceTest.java100
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ComposedServiceTest.java135
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedService.java45
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePart.java26
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartA.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartB.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeService.java74
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeServiceFactory.java65
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeWithRequiredServiceFactory.java53
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA.java49
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA10.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceB.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceC.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicePojoA.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicesRegistryTest.java733
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/TestTrace.java181
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/AbstractModelWithSharedResourceTest.java307
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModel.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelManagerSnippet.java61
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelWithSharedResource.java100
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/ModelSetTest.java485
-rw-r--r--plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/TestTrace.java153
-rw-r--r--plugins/core/org.eclipse.papyrus.di.edit/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.di.edit/build.properties9
-rw-r--r--plugins/core/org.eclipse.papyrus.di.edit/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.di.editor/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.di.editor/build.properties9
-rw-r--r--plugins/core/org.eclipse.papyrus.di.editor/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.di/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.di/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.editor/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.editor/plugin.xml1
-rw-r--r--plugins/core/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java67
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/.checkstyle7
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/.classpath (renamed from plugins/core/org.eclipse.papyrus.service.creation/.classpath)0
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/.project (renamed from plugins/core/org.eclipse.papyrus.service.creation/.project)2
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/META-INF/MANIFEST.MF21
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/build.properties9
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/Add_12x12.gifbin0 -> 345 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/Delete_12x12.gifbin0 -> 367 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/Down_12x12.gifbin0 -> 308 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/PapyrusLogo16x16.gifbin0 -> 561 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/Up_12x12.gifbin0 -> 338 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/arrow_double.gifbin0 -> 594 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/arrow_left.gifbin0 -> 327 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/arrow_left_double.gifbin0 -> 597 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/icons/arrow_right.gifbin0 -> 541 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/plugin.properties12
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractEditor.java177
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractListEditor.java154
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractValueEditor.java153
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/Activator.java88
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanCheckbox.java79
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanRadio.java103
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleReferenceEditor.java69
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleValueEditor.java233
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/EnumCombo.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/FloatEditor.java58
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IElementSelector.java52
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IntegerEditor.java71
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleIntegerEditor.java32
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleReferenceEditor.java101
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleStringEditor.java47
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueEditor.java366
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueSelectorDialog.java504
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/ReferenceCombo.java143
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/StringEditor.java113
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/Messages.java54
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/messages.properties7
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/CollectionContentProvider.java58
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/EncapsulatedContentProvider.java108
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/IStaticContentProvider.java29
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/ReferenceSelector.java256
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StandardSelector.java93
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StringSelector.java94
-rw-r--r--plugins/core/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.extensionpoints.editors/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.log/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.log/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/META-INF/MANIFEST.MF7
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/build.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/sort.gifbin0 -> 153 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/validate.gifbin0 -> 104 bytes
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/plugin.xml297
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/Activator.java21
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/CustomCommonViewer.java61
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ITooltip.java67
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/LinkHelper.java79
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProvider.java131
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProviderWTooltips.java68
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPage.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPageBookView.java91
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerView.java255
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/SemanticFromModelExplorer.java50
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateChildActionProvider.java59
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateDiagramActionProvider.java19
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/CreateDiagramAction.java21
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/GenericTransformer.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/PasteShapeOrElementAction.java62
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/RenameDiagramAction.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/AbstractValidateCommand.java199
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/EObjectInheritanceCopyCommand.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromModelCommand.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromSubtreeCommand.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateModelCommand.java45
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateSubtreeCommand.java40
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/dnd/CommonDropAdapterAssistant.java295
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/factory/DefaultEMFActionsFactory.java71
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/AbstractCommandHandler.java176
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/DeleteCommandHandler.java113
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/GMFtoEMFCommandWrapper.java129
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/LoadBrowserCustomization.java11
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/SortElementHandler.java101
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromModelHandler.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromSubtreeHandler.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateModelHandler.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateSubtreeHandler.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/listener/DoubleClickListener.java63
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/provider/ActionStateSourceProvider.java294
-rw-r--r--plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/validation/ValidationTool.java127
-rw-r--r--plugins/core/org.eclipse.papyrus.perspective/META-INF/MANIFEST.MF6
-rw-r--r--plugins/core/org.eclipse.papyrus.perspective/build.properties7
-rw-r--r--plugins/core/org.eclipse.papyrus.perspective/plugin.properties14
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Activator.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Messages.java9
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceInitializer.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceStore.java166
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusScopedPreferenceStore.java282
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/ColorFieldEditor.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/FontFieldEditor.java5
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/GradientFieldEditor.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/messages.properties1
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusNodePreferencePage.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusPreferencePage.java19
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/DiagramPreferencePage.java31
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/PapyrusAllDiagramsPreferencePage.java60
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/internal/VisiblePageSingleton.java35
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/AbstractGroup.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/BackgroundColor.java17
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/ConnectionGroup.java42
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DecorationGroup.java38
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DimensionGroup.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/LinkColorGroup.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeColorGroup.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeCompartmentGroup.java132
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramBackgroundColor.java15
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramConnectionGroup.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDecorationGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDimensionGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramFontGroup.java15
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramLinkColorGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramNodeColorGroup.java16
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/AbstractPreferenceKeyDialog.java119
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java34
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorBackgroundColor.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorConnectionGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDecorationGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDimensionGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorFontGroup.java15
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorLinkColorGroup.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorNodeColorGroup.java16
-rw-r--r--plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/utils/PreferenceConstantHelper.java91
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/META-INF/MANIFEST.MF6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/build.properties10
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/plugin.xml39
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/resources/predefined_controllers.xml4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/Messages.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTEReferenceController.java206
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java57
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTStructuralFeatureController.java104
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IBoundedValuesController.java19
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IPropertyEditorController.java86
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/NullPropertyEditorController.java153
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/PropertyEditorController.java7
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/EMFTPropertyEditorControllerDescriptor.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptor.java91
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptorFactory.java52
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/predefined/PredefinedControllerState.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/messages.properties1
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/BooleanEMFModelHandler.java61
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFFeatureModelHandler.java787
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFStereotypeFeatureModelHandler.java75
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFUtils.java33
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationEMFModelHandler.java231
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationStereotypeModelHandler.java142
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/IEMFModelHandler.java119
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceEMFModelHandler.java240
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceStereotypeModelHandler.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringEMFModelHandler.java268
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringStereotypeModelHandler.java152
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/TransactionUtil.java63
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java497
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java100
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditorValidator.java36
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java721
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleStructuralFeaturesPropertyEditor.java416
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditor.java100
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditorTypeValidator.java34
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/PropertyEditorService.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/RadioBoxPropertyEditor.java7
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptor.java53
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptorFactory.java74
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/PropertyViewService.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ContainerDescriptor.java9
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ExpandableContainerDescriptor.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/GroupContainerDescriptor.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/build.properties6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/DynamicSection.java12
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/PropertyTabViewProviderParser.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/ReferenceStateBeanPropertyEditorController.java14
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/StateBeanPropertyEditorController.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor.di/.classpath2
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor.di/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor.di/plugin.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/.classpath3
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/META-INF/MANIFEST.MF7
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/build.properties6
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/Activator.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/Activator.java)5
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPage.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPage.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/Copyright.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/Copyright.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/EditorPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/EditorPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PagePart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PagePart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartLists.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartLists.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/RootPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/RootPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java (renamed from plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java)0
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngrTest.java53
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/FakePageModel.java65
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProviderTest.java202
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/FakeEditorModel.java121
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/MessagePartModel.java73
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/SashMultiPageEditorTest.java21
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/ShellEditor.java113
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakePagePart.java57
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakeSashContainerEventsListener.java185
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProviderTest.java184
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerEventsProviderTest.java307
-rw-r--r--plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerTest.java352
-rw-r--r--plugins/core/org.eclipse.papyrus.service.creation/plugin.xml14
-rw-r--r--plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/BaseCommandProvider.java32
-rw-r--r--plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/CommandProviderService.java40
-rw-r--r--plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/ICommandProvider.java24
-rw-r--r--plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/utils/CreationServiceUtils.java43
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/.classpath7
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/.project28
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/META-INF/MANIFEST.MF (renamed from plugins/core/org.eclipse.papyrus.service.creation/META-INF/MANIFEST.MF)11
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/build.properties (renamed from plugins/core/org.eclipse.papyrus.service.creation/build.properties)4
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/plugin.properties (renamed from plugins/core/org.eclipse.papyrus.service.creation/plugin.properties)7
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/plugin.xml58
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/Activator.java (renamed from plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/Activator.java)37
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/context/TypeContext.java55
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditService.java136
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProvider.java132
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProviderFactory.java69
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/matcher/NoContextEnablementMatcher.java37
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/ElementEditServiceUtils.java106
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditService.java78
-rw-r--r--plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditServiceProvider.java62
-rw-r--r--plugins/core/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.tabbedproperties.core/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.tabbedproperties.core/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/META-INF/MANIFEST.MF3
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/build.properties6
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF2
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/build.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.wizards/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/META-INF/MANIFEST.MF6
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/about.html28
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/build.properties3
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/PopupEditorConfiguration.java11
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CompletionProposalUtils.java152
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CustomCompletionProposal.java132
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/DefaultXtextSemanticValidator.java32
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/IXTextSemanticValidator.java33
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java76
-rw-r--r--plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java35
398 files changed, 13499 insertions, 7135 deletions
diff --git a/plugins/core/org.eclipse.papyrus.controlmode.history/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.controlmode.history/META-INF/MANIFEST.MF
index 7da65f319fc..ddaca9b4ba9 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode.history/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.controlmode.history/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.controlmode.history;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/core/org.eclipse.papyrus.controlmode.history/about.html b/plugins/core/org.eclipse.papyrus.controlmode.history/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.controlmode.history/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.controlmode.history/build.properties b/plugins/core/org.eclipse.papyrus.controlmode.history/build.properties
index 1a3a48b2220..d8548418d3b 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode.history/build.properties
+++ b/plugins/core/org.eclipse.papyrus.controlmode.history/build.properties
@@ -8,7 +8,8 @@ bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
- plugin.properties
+ plugin.properties,\
+ about.html
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/plugins/core/org.eclipse.papyrus.controlmode.history/plugin.properties b/plugins/core/org.eclipse.papyrus.controlmode.history/plugin.properties
index e10928bc6a3..eb8de4d2fd8 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode.history/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.controlmode.history/plugin.properties
@@ -9,4 +9,4 @@
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
pluginName=Papyrus Control Mode Trace (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.controlmode/META-INF/MANIFEST.MF
index 9b3a0845f1d..38e7734ea9e 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.controlmode/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.controlmode;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.controlmode.ControlModePlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/about.html b/plugins/core/org.eclipse.papyrus.controlmode/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.controlmode/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/build.properties b/plugins/core/org.eclipse.papyrus.controlmode/build.properties
index 18cdfdd1c4c..d54ca0d50dd 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/build.properties
+++ b/plugins/core/org.eclipse.papyrus.controlmode/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties,\
- schema/
+ schema/,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/plugin.properties b/plugins/core/org.eclipse.papyrus.controlmode/plugin.properties
index 648629511dd..2e5ca939240 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.controlmode/plugin.properties
@@ -8,5 +8,5 @@
# * http://www.eclipse.org/legal/epl-v10.html
# *
# *****************************************************************************/
-pluginName=Papyrus Control Mode
-providerName=Eclipse.org
+pluginName=Papyrus Control Mode (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/CollaborativeActionsFactory.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/CollaborativeActionsFactory.java
index 58f3c7c6a70..639a8813c78 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/CollaborativeActionsFactory.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/action/CollaborativeActionsFactory.java
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.controlmode.action;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -20,6 +22,8 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.modelexplorer.NavigatorUtils;
import org.eclipse.papyrus.modelexplorer.factory.IActionHandlerFactory;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.navigator.CommonNavigator;
@@ -93,12 +97,25 @@ public class CollaborativeActionsFactory implements IActionHandlerFactory {
public void fillActionBars(IActionBars actionBars) {
// actionBars.setGlobalActionHandler(actionId, handler);
}
-
+
/**
* {@inheritDoc}
*/
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public void update(IStructuredSelection structuredSelection) {
- // do nothing
+ ArrayList array = new ArrayList();
+ Iterator iterator = structuredSelection.iterator();
+ while(iterator.hasNext()) {
+ Object object = (Object)iterator.next();
+ if(NavigatorUtils.resolveSemanticObject(object) != null) {
+ array.add(NavigatorUtils.resolveSemanticObject(object));
+ }
+ }
+ StructuredSelection st = new StructuredSelection(array);
+ controlAction.updateSelection(st);
+ controlAction.setEnabled(controlAction.isEnabled());
+ uncontrolAction.updateSelection(st);
+ uncontrolAction.setEnabled(uncontrolAction.isEnabled());
}
}
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
index ebda1abb406..8df84238fa0 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/ControlCommand.java
@@ -32,7 +32,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -172,7 +171,7 @@ public class ControlCommand extends AbstractTransactionalCommand {
saveResources();
return Status.OK_STATUS;
} else {
- NotificationBuilder.createErrorPopup(CommonPlugin.INSTANCE.getString("_UI_UnexecutableCommand_description")).setTitle(CommonPlugin.INSTANCE.getString("_UI_UnexecutableCommand_label")).run();
+ NotificationBuilder.createErrorPopup("Unable to execute control command").setTitle("Unable to control").run();
return Status.CANCEL_STATUS;
}
}
@@ -207,7 +206,7 @@ public class ControlCommand extends AbstractTransactionalCommand {
}
/**
- * Analyse the history model to update the controlled children
+ * Analyze the history model to update the controlled children
*
* @param domain
* @param compoundCommand
@@ -220,7 +219,6 @@ public class ControlCommand extends AbstractTransactionalCommand {
return;
}
// create relative path
-
URI uriPath = HistoryUtils.getURIFullPath(currentURL);
String currentURLResolved = HistoryUtils.resolve(uriPath, currentURL);
String newURLResolved = HistoryUtils.resolve(uriPath, newURL);
@@ -229,14 +227,16 @@ public class ControlCommand extends AbstractTransactionalCommand {
child.setResourceURL(newURLResolved);
ControledResource resource = model.getModelRoot();
+ Resource parentResource = null;
- // create the controled resource according to the control action
+ // create the controlled resource according to the control action
ControledResource parent = null;
if(resource == null) {
parent = historyFactory.eINSTANCE.createControledResource();
parent.setResourceURL(currentURLResolved);
parent.getChildren().add(child);
- compoundCommand.append(new AddCommand(domain, model.getResource().getContents(), Collections.singleton(parent)));
+ parentResource = model.getResource();
+ compoundCommand.append(new AddCommand(domain, parentResource.getContents(), Collections.singleton(parent)));
} else {
if(isCurrentURL(currentURLResolved, resource)) {
parent = resource;
@@ -256,27 +256,32 @@ public class ControlCommand extends AbstractTransactionalCommand {
if(parent == null) {
parent = historyFactory.eINSTANCE.createControledResource();
parent.setResourceURL(currentURLResolved);
- resource.eResource().getContents().add(parent);
+ parentResource = resource.eResource();
+ compoundCommand.append(new AddCommand(domain, parentResource.getContents(), Collections.singleton(parent)));
}
if(parent != null) {
compoundCommand.append(AddCommand.create(domain, parent, historyPackage.Literals.CONTROLED_RESOURCE__CHILDREN, Collections.singleton(child)));
}
}
List<ControledResource> controledFromParent = new LinkedList<ControledResource>();
- Resource parentResource = parent.eResource();
- for(EObject e : parentResource.getContents()) {
- if(e instanceof ControledResource) {
- ControledResource aControled = (ControledResource)e;
- controledFromParent.add(aControled);
- for(Iterator<EObject> i = aControled.eAllContents(); i.hasNext();) {
- EObject tmp = i.next();
- if(tmp instanceof ControledResource) {
- controledFromParent.add((ControledResource)tmp);
+ if(parentResource == null) {
+ parentResource = model.getResource();
+ }
+ if(parentResource != null) {
+ for(EObject e : parentResource.getContents()) {
+ if(e instanceof ControledResource) {
+ ControledResource aControled = (ControledResource)e;
+ controledFromParent.add(aControled);
+ for(Iterator<EObject> i = aControled.eAllContents(); i.hasNext();) {
+ EObject tmp = i.next();
+ if(tmp instanceof ControledResource) {
+ controledFromParent.add((ControledResource)tmp);
+ }
}
}
}
}
- // manage move of existing controled resource
+ // manage move of existing controlled resource
if(!newURL.endsWith(NotationModel.NOTATION_FILE_EXTENSION)) {
assignToChildExistingControledResources(domain, compoundCommand, child, newURL, controledFromParent, currentURL, URI.createURI(newURL), uriPath);
}
diff --git a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
index 9feab9c38f7..499a109f870 100644
--- a/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
+++ b/plugins/core/org.eclipse.papyrus.controlmode/src/org/eclipse/papyrus/controlmode/commands/UncontrolCommand.java
@@ -35,7 +35,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -169,7 +168,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
deleteControlledResources();
return Status.OK_STATUS;
} else {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), CommonPlugin.INSTANCE.getString("_UI_UnexecutableCommand_label"), CommonPlugin.INSTANCE.getString("_UI_UnexecutableCommand_description"));
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Unable to uncontrol", "Unable to execute uncontrol command");
return Status.CANCEL_STATUS;
}
}
@@ -239,6 +238,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
if(model == null) {
return;
}
+ // TODO move the history model from the controlled resource to the parent DI resource
URI uriPath = HistoryUtils.getURIFullPath(newURL);
newURL = HistoryUtils.resolve(uriPath, newURL);
oldURL = HistoryUtils.resolve(uriPath, oldURL);
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/META-INF/MANIFEST.MF
index 036b720c6d4..24bd414ce38 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.core.adaptor.emf;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.core.adaptor.emf.Activator
Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.7.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/plugin.properties b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/plugin.properties
index 036489e988d..758ec364b5c 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/plugin.properties
@@ -9,4 +9,4 @@
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
pluginName=Papyrus EMF Tree Adaptor (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/META-INF/MANIFEST.MF
index d18ce06ab87..50fbaa5432d 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.core.adaptor.gmf;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/plugin.properties b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/plugin.properties
index e9e9eabc98e..f72830a71a2 100644
--- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/plugin.properties
@@ -9,7 +9,7 @@
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
pluginName=UML Papyrus GMF Editor (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SemanticFromGMFElement.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SemanticFromGMFElement.java
new file mode 100644
index 00000000000..7f75a88ebf5
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SemanticFromGMFElement.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.core.adaptor.gmf;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.papyrus.core.IElementWithSemantic;
+
+/**
+ * this class is used to obtain the semantic element for element of a gmf diagram
+ *
+ */
+public class SemanticFromGMFElement implements IElementWithSemantic {
+ /**
+ *
+ * @see org.eclipse.papyrus.core.IElementWithSemantic#getSemanticElement(java.lang.Object)
+ *
+ * @param wrapper can be for examplean editpart of gmf
+ * @return the semantic element linked to this or null element
+ */
+ public Object getSemanticElement(Object wrapper) {
+ if(wrapper instanceof IGraphicalEditPart){
+ return ((IGraphicalEditPart)wrapper).resolveSemanticElement();
+ }
+ if( wrapper instanceof IAdaptable){
+ return ((IAdaptable)wrapper).getAdapter(EObject.class);
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java
new file mode 100644
index 00000000000..04f97d22a4c
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/SynchronizableGmfDiagramEditor.java
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.core.adaptor.gmf;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.papyrus.core.ui.IRevealSemanticElement;
+
+/**
+ /**
+ *
+ * This GMF editor contains a methods in order to reveal visual element from a list of semantic element.
+ *
+ */
+
+public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor implements IRevealSemanticElement {
+
+ public SynchronizableGmfDiagramEditor(boolean hasFlyoutPalette) {
+ super(hasFlyoutPalette);
+ }
+
+
+ /**
+ * reveal all editpart that represent an element in the given list.
+ * @see org.eclipse.papyrus.core.ui.IRevealSemanticElement#revealSemanticElement(java.util.List)
+ *
+ */
+ public void revealSemanticElement(List<?> elementList) {
+ //create an instance that can get semantic element from gmf
+ SemanticFromGMFElement semanticFromGMFElement= new SemanticFromGMFElement();
+
+ // get the graphical viewer
+ GraphicalViewer graphicalViewer =getGraphicalViewer() ;
+ if( graphicalViewer!=null){
+
+ //look for among all edit part if the semantic is contained in the list
+ Iterator<?> iter=graphicalViewer.getEditPartRegistry().values().iterator();
+ IGraphicalEditPart researchedEditPart=null;
+ while(iter.hasNext()&& researchedEditPart==null) {
+ Object currentEditPart = (Object)iter.next();
+ //look for only among IPrimary editpart to avoid compartment and labels of links
+ if(currentEditPart instanceof IPrimaryEditPart){
+ if(elementList.contains(semanticFromGMFElement.getSemanticElement(currentEditPart))){
+ researchedEditPart=((IGraphicalEditPart)currentEditPart);}
+ }
+
+ }
+ //an editpart has been found so put selection on it.
+ if(researchedEditPart!=null){
+ graphicalViewer.select(researchedEditPart);
+ }
+ }
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.core.feature/feature.xml b/plugins/core/org.eclipse.papyrus.core.feature/feature.xml
index 4dec44fbf4a..3daeeae23c2 100644
--- a/plugins/core/org.eclipse.papyrus.core.feature/feature.xml
+++ b/plugins/core/org.eclipse.papyrus.core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.papyrus.core.feature"
label="%featureName"
- version="0.7.0.vqualifier"
+ version="0.7.1.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/modeling/mdt/?project=papyrus">
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/META-INF/MANIFEST.MF
index 63d14469a6f..04559042ce5 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.core.resourceloading.preferences;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.core.resourceloading.preferences.CorePlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/about.html b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/build.properties b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/build.properties
index 6f20375d6c7..bfa98369607 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/build.properties
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/build.properties
@@ -2,4 +2,6 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/plugin.properties b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/plugin.properties
index 06a314d97c8..7b739f306eb 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading.preferences/plugin.properties
@@ -11,5 +11,5 @@
# * Emilien Perico emilien.perico@atosorigin.com - Initial API and implementation
# *
# *****************************************************************************/
-pluginName=Preferences for resource loading feature
-providerName=Eclipse.org
+pluginName=Preferences for resource loading feature (Incubation)
+providerName=Eclipse Modeling Project \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core.resourceloading/META-INF/MANIFEST.MF
index 5c893a42bb5..27d775aa9cf 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.core.resourceloading;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.core.resourceloading.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.core,
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading/about.html b/plugins/core/org.eclipse.papyrus.core.resourceloading/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading/build.properties b/plugins/core/org.eclipse.papyrus.core.resourceloading/build.properties
index dfcfc66b474..50048da27a6 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading/build.properties
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
schema/,\
- plugin.properties
+ plugin.properties,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.core.resourceloading/plugin.properties b/plugins/core/org.eclipse.papyrus.core.resourceloading/plugin.properties
index 1083cb46906..ef60c0686c2 100644
--- a/plugins/core/org.eclipse.papyrus.core.resourceloading/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.core.resourceloading/plugin.properties
@@ -8,5 +8,5 @@
# Contributors:
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
-pluginName=Papyrus Resource Loading
-providerName=Eclipse.org
+pluginName=Papyrus Resource Loading (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.core/.classpath b/plugins/core/org.eclipse.papyrus.core/.classpath
index b04b8be8f5d..024fd574b42 100644
--- a/plugins/core/org.eclipse.papyrus.core/.classpath
+++ b/plugins/core/org.eclipse.papyrus.core/.classpath
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test"/>
+ <!-- <classpathentry kind="src" path="test"/>-->
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF
index c7dd41e99b5..efa3b30e227 100644
--- a/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF
@@ -3,13 +3,12 @@ Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.core;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.core.Activator
Require-Bundle: org.eclipse.papyrus.sasheditor;bundle-version="0.7.0";visibility:=reexport,
org.eclipse.papyrus.sasheditor.di;bundle-version="0.7.0";visibility:=reexport,
org.eclipse.ui.ide;bundle-version="3.4.0";visibility:=reexport,
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.1.0";visibility:=reexport,
- org.junit,
org.eclipse.emf.edit.ui;bundle-version="2.6.0";visibility:=reexport
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -26,6 +25,7 @@ Export-Package: org.eclipse.papyrus.core,
org.eclipse.papyrus.core.modelsetquery.impl;x-friends:="org.eclipse.papyrus.resourceloading.umlprofile",
org.eclipse.papyrus.core.multidiagram.actionbarcontributor,
org.eclipse.papyrus.core.services,
+ org.eclipse.papyrus.core.ui,
org.eclipse.papyrus.core.utils,
org.eclipse.papyrus.resource,
org.eclipse.papyrus.resource.notation,
diff --git a/plugins/core/org.eclipse.papyrus.core/about.html b/plugins/core/org.eclipse.papyrus.core/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.core/build.properties b/plugins/core/org.eclipse.papyrus.core/build.properties
index 09c7910f9b3..8541784de93 100644
--- a/plugins/core/org.eclipse.papyrus.core/build.properties
+++ b/plugins/core/org.eclipse.papyrus.core/build.properties
@@ -11,13 +11,5 @@ bin.includes = META-INF/,\
about.properties,\
about.html
src.includes = about.html,\
- .classpath,\
- .options,\
- .project,\
- META-INF/,\
- plugin.properties,\
- build.properties,\
icons/,\
- plugin.xml,\
schema/,\
- src/
diff --git a/plugins/core/org.eclipse.papyrus.core/plugin.properties b/plugins/core/org.eclipse.papyrus.core/plugin.properties
index 4ce5500d6a1..c3609c2ddcc 100644
--- a/plugins/core/org.eclipse.papyrus.core/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.core/plugin.properties
@@ -9,4 +9,4 @@
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
pluginName=Papyrus Backbone (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/IElementWithSemantic.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/IElementWithSemantic.java
new file mode 100644
index 00000000000..dd2aa1f7b26
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/IElementWithSemantic.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ */
+package org.eclipse.papyrus.core;
+
+/**
+ *
+ * all implementation is used to give the semantic element form a wrapper
+ *
+ * the implementation can call method getAdapter for example
+ * for notation element return semantic element, for edit part return the semantic
+ * element and not the view...
+ */
+public interface IElementWithSemantic {
+
+ /**
+ * return the semantic element linked to this wrapper
+ * @param wrapper an object that wrapped or are linked to a semantic element <B>cannot be null</B>
+ * @return null or the semantic element
+ */
+ public Object getSemanticElement(Object wrapper);
+}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/contentoutline/ContentOutlineRegistry.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/contentoutline/ContentOutlineRegistry.java
index dcf126dfd36..fa2109194aa 100644
--- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/contentoutline/ContentOutlineRegistry.java
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/contentoutline/ContentOutlineRegistry.java
@@ -212,7 +212,7 @@ public class ContentOutlineRegistry {
try {
String declaringID = element.getContributor().getName();
Bundle bundle = Platform.getBundle(declaringID);
- factoryClass = bundle.loadClass(className);
+ factoryClass = (Class<IPapyrusContentOutlinePage>)bundle.loadClass(className);
} catch (ClassNotFoundException e1) {
throw new BadClassNameException("", "contentoutline", classAttributeName, e1);
}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java
index ef4d5299113..0dc3bab2524 100644
--- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
@@ -69,8 +70,14 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IGotoMarker;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
@@ -91,7 +98,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
*
* TODO : remove GMF dependency !
*/
-public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IDiagramWorkbenchPart {
+public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IDiagramWorkbenchPart, IGotoMarker {
/** Gef adapter */
private MultiDiagramEditorGefDelegate gefAdaptorDelegate;
@@ -114,15 +121,17 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
* Service used to maintain the dirty state and to perform save and saveAs.
*/
protected ISaveAndDirtyService saveAndDirtyService;
-
+
/**
* Listener on {@link ISaveAndDirtyService#addInputChangedListener(IEditorInputChangedListener)}
*/
protected IEditorInputChangedListener editorInputChangedListener = new IEditorInputChangedListener() {
+
/**
* This method is called when the editor input is changed from the ISaveAndDirtyService.
+ *
* @see org.eclipse.papyrus.core.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput)
- *
+ *
* @param fileEditorInput
*/
public void editorInputChanged(FileEditorInput fileEditorInput) {
@@ -133,11 +142,12 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* The isDirty flag has changed, reflect its new value
+ *
* @see org.eclipse.papyrus.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged()
- *
+ *
*/
public void isDirtyChanged() {
-
+
// Run it in async way.
getSite().getShell().getDisplay().asyncExec(new Runnable() {
@@ -147,13 +157,13 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
});
}
};
-
+
private TransactionalEditingDomain transactionalEditingDomain;
/**
* Object managing models lifeCycle.
*/
- protected ModelSet resourceSet ;
+ protected ModelSet resourceSet;
/**
* Cached event that can be reused.
@@ -190,7 +200,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Undo context used to have the same undo context in all Papyrus related views and editors.
- * TODO : move away, use a version independent of GMF, add a listener that will add
+ * TODO : move away, use a version independent of GMF, add a listener that will add
* the context to all commands modifying attached Resources (==> linked to ModelSet ?)
*/
private EditingDomainUndoContext undoContext;
@@ -367,15 +377,14 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
* Return context used for undo/redo.
* All papyrus views should use this context.
*/
- if( IUndoContext.class == adapter)
- {
- if( undoContext != null)
+ if(IUndoContext.class == adapter) {
+ if(undoContext != null)
return undoContext;
-
+
undoContext = new EditingDomainUndoContext(transactionalEditingDomain);
return undoContext;
}
-
+
// EMF requirements
if(IEditingDomainProvider.class == adapter) {
@@ -419,12 +428,12 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
BusinessModelResolver.getInstance();
// Load resources
-// resourceSet = new DiResourceSet();
-// IFile file = ((IFileEditorInput)input).getFile();
-// resourceSet.loadResources(file);
+ // resourceSet = new DiResourceSet();
+ // IFile file = ((IFileEditorInput)input).getFile();
+ // resourceSet.loadResources(file);
// Create the 2 edit domains
-// transactionalEditingDomain = resourceSet.getTransactionalEditingDomain();
+ // transactionalEditingDomain = resourceSet.getTransactionalEditingDomain();
// Create Gef adaptor
gefAdaptorDelegate = new MultiDiagramEditorGefDelegate();
@@ -435,34 +444,34 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
// Add itself as a service
servicesRegistry.add(IMultiDiagramEditor.class, 1, this);
-
+
// Create lifeCycle event provider and the event that is used when the editor fire a save event.
-// lifeCycleEventsProvider = new LifeCycleEventsProvider();
-// lifeCycleEvent = new DoSaveEvent(servicesRegistry, this);
-// servicesRegistry.add(ILifeCycleEventsProvider.class, 1, lifeCycleEventsProvider);
+ // lifeCycleEventsProvider = new LifeCycleEventsProvider();
+ // lifeCycleEvent = new DoSaveEvent(servicesRegistry, this);
+ // servicesRegistry.add(ILifeCycleEventsProvider.class, 1, lifeCycleEventsProvider);
// register services
servicesRegistry.add(ActionBarContributorRegistry.class, 1, getActionBarContributorRegistry());
-// servicesRegistry.add(TransactionalEditingDomain.class, 1, transactionalEditingDomain);
-// servicesRegistry.add(DiResourceSet.class, 1, resourceSet);
+ // servicesRegistry.add(TransactionalEditingDomain.class, 1, transactionalEditingDomain);
+ // servicesRegistry.add(DiResourceSet.class, 1, resourceSet);
// Create and initalize editor icons service
-// PageIconsRegistry pageIconsRegistry = new PageIconsRegistry();
-// PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID);
-// editorReader.populate(pageIconsRegistry);
-// servicesRegistry.add(IPageIconsRegistry.class, 1, pageIconsRegistry);
+ // PageIconsRegistry pageIconsRegistry = new PageIconsRegistry();
+ // PluggableEditorFactoryReader editorReader = new PluggableEditorFactoryReader(Activator.PLUGIN_ID);
+ // editorReader.populate(pageIconsRegistry);
+ // servicesRegistry.add(IPageIconsRegistry.class, 1, pageIconsRegistry);
// Create PageModelRegistry requested by content provider.
// Also populate it from extensions.
-// PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry();
-// editorReader.populate(pageModelRegistry, servicesRegistry);
+ // PageModelFactoryRegistry pageModelRegistry = new PageModelFactoryRegistry();
+ // editorReader.populate(pageModelRegistry, servicesRegistry);
// TODO : create appropriate Resource for the contentProvider, and pass it here.
// This will allow to remove the old sash stuff.
-// setContentProvider(createPageProvider(pageModelRegistry, resourceSet.getDiResource(), transactionalEditingDomain));
-// servicesRegistry.add(ISashWindowsContentProvider.class, 1, getContentProvider());
-// servicesRegistry.add(IPageMngr.class, 1, getIPageMngr());
+ // setContentProvider(createPageProvider(pageModelRegistry, resourceSet.getDiResource(), transactionalEditingDomain));
+ // servicesRegistry.add(ISashWindowsContentProvider.class, 1, getContentProvider());
+ // servicesRegistry.add(IPageMngr.class, 1, getIPageMngr());
// register a basic label provider
// adapter factory used by EMF objects
@@ -495,22 +504,22 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
// Start the ModelSet first, and load if from the specified File
List<Class<?>> servicesToStart = new ArrayList<Class<?>>(1);
servicesToStart.add(ModelSet.class);
-
- servicesRegistry.startServicesByClassKeys( servicesToStart );
+
+ servicesRegistry.startServicesByClassKeys(servicesToStart);
resourceSet = servicesRegistry.getService(ModelSet.class);
resourceSet.loadModels(file);
-
+
// start remaining services
servicesRegistry.startRegistry();
} catch (ModelMultiException e) {
log.error(e);
- throw new PartInitException ("errors in model", e);
+ throw new PartInitException("errors in model", e);
} catch (ServiceException e) {
log.error(e);
- throw new PartInitException ("could not initialize services", e);
+ throw new PartInitException("could not initialize services", e);
}
-
-
+
+
// Get required services
ISashWindowsContentProvider contentProvider = null;
try {
@@ -521,20 +530,18 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
} catch (ServiceException e) {
log.error("A required service is missing.", e);
// if one of the services above fail to start, the editor can't run => stop
- throw new PartInitException ("could not initialize services", e);
+ throw new PartInitException("could not initialize services", e);
}
-
-
// Set the content provider providing editors.
setContentProvider(contentProvider);
-
+
// Set editor name
setPartName(file.getName());
// Listen on contentProvider changes
sashModelMngr.getSashModelContentChangedProvider().addListener(contentChangedListener);
-
+
// Listen on input changed from the ISaveAndDirtyService
saveAndDirtyService.addInputChangedListener(editorInputChangedListener);
}
@@ -763,4 +770,18 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
setInputWithNotify(newInput);
setPartName(newInput.getName());
}
+
+ public void gotoMarker(IMarker marker) {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage();
+ for(IViewReference view : page.getViewReferences()) {
+ if(view.getId().equals("org.eclipse.papyrus.modelexplorer.modelexplorer")) {
+ page.activate(view.getPart(false));
+ IWorkbenchPart part = view.getPart(false);
+ if(part instanceof IGotoMarker) {
+ ((IGotoMarker)part).gotoMarker(marker);
+ }
+ }
+ }
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/ui/IRevealSemanticElement.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/ui/IRevealSemanticElement.java
new file mode 100644
index 00000000000..76d41e2deb7
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/ui/IRevealSemanticElement.java
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ */
+package org.eclipse.papyrus.core.ui;
+
+import java.util.List;
+
+/**
+ * this interface is used to reveal element that are given in parameter.
+ * Example of the use case:
+ * the class that implements this interface can be a diagram that select all editparts
+ * that are linked to the given list of semantic element
+ *
+ */
+public interface IRevealSemanticElement {
+/**
+ * reveal all elements that represent an element in the given list.
+ * @param elementList list of semantic element that we want to reveal, <B> cannot be null</B>
+ */
+ public void revealSemanticElement(List<?> elementList);
+}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/PapyrusEcoreUtils.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/PapyrusEcoreUtils.java
new file mode 100644
index 00000000000..5ec232e2519
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/PapyrusEcoreUtils.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.core.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+
+public class PapyrusEcoreUtils {
+
+ /**
+ * Gets the usages.
+ *
+ * @param source
+ * the source
+ *
+ * @return the usages or null if there is no usages
+ */
+ public static Collection<EStructuralFeature.Setting> getUsages(EObject source) {
+ Collection<EStructuralFeature.Setting> collection = null;
+ ECrossReferenceAdapter crossReferenceAdapter = ECrossReferenceAdapter.getCrossReferenceAdapter(source);
+ if(crossReferenceAdapter != null) {
+ collection = crossReferenceAdapter.getNonNavigableInverseReferences(source);
+ } else {
+ collection = EcoreUtil.UsageCrossReferencer.find(source, source.eResource().getResourceSet());
+ }
+ return collection;
+ }
+
+ /**
+ * <pre>
+ * Test if the used element is referenced by other elements than the known
+ * referencer (except its container). It ignores references from an other meta-model.
+ * </pre>
+ *
+ * @param usedObject
+ * the used object
+ * @param knownReferencer
+ * the known referencer
+ * @return true if the known referencer is the only referencer.
+ */
+ public static boolean isOnlyUsage(EObject usedObject, EObject knownReferencer) {
+ boolean isUsed = false;
+ EPackage mmPackage = usedObject.eClass().getEPackage();
+
+ // Retrieve the list of elements referencing the usedObject.
+ Set<EObject> crossReferences = new HashSet<EObject>();
+ for(Setting setting : PapyrusEcoreUtils.getUsages(usedObject)) {
+ EObject eObj = setting.getEObject();
+ if (eObj.eClass().getEPackage().equals(mmPackage)) {
+ crossReferences.add(eObj);
+ }
+ }
+
+ // Remove the container of used object.
+ crossReferences.remove(usedObject.eContainer());
+ // Remove the knownReferencer from the list of references.
+ crossReferences.remove(knownReferencer);
+
+ // If no referencer remains in the list, the known element is the only usage.
+ if (crossReferences.isEmpty()) {
+ isUsed = true;
+ }
+
+ return isUsed;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/ValidationUtils.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/ValidationUtils.java
new file mode 100644
index 00000000000..39416d4876e
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/ValidationUtils.java
@@ -0,0 +1,78 @@
+package org.eclipse.papyrus.core.utils;
+
+import java.util.Map;
+import java.util.MissingResourceException;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+
+public class ValidationUtils {
+
+ /**
+ * Return the EObject retrieved from the URI attribute in the map. Retrieve it either via the marker itself
+ * or via the attribute mapping (required in case a deleted marker)
+ *
+ * @param marker
+ * the problem marker
+ * @param attributes
+ * a map of the problem marker
+ * @param domain
+ * the editing domain used for the conversion from URI to eObecjt
+ * @return
+ */
+ public static EObject eObjectFromMarkerOrMap(IMarker marker, @SuppressWarnings("rawtypes") Map attributes, EditingDomain domain) {
+ String uriAttribute;
+ if(domain == null) {
+ return null;
+ }
+ if(marker != null) {
+ uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ } else {
+ uriAttribute = (String)attributes.get(EValidator.URI_ATTRIBUTE);
+ }
+ if(uriAttribute != null) {
+ URI uriOfMarker = URI.createURI(uriAttribute);
+ try {
+ return domain.getResourceSet().getEObject(uriOfMarker, true);
+ } catch (MissingResourceException e) {
+ // happens after renaming of the file containing the marker (or a parent folder)
+ // try to retrieve eObject via fragment only (assuming that no two elements within resource-set share
+ // the same fragment).
+ return eObjectOfFragment(uriOfMarker, domain);
+ } catch (WrappedException e) {
+ // same as above, seems to depend on context which exception is thrown.
+ return eObjectOfFragment(uriOfMarker, domain);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return an eObject from the set of resources associated with an editing domain.
+ * The first EObject whose ID corresponds to the fragment of the URI is returned.
+ *
+ * @param uri
+ * the URI of an element
+ * @param domain
+ * the editing domain
+ * @return
+ */
+ public static EObject eObjectOfFragment(URI uri, EditingDomain domain) {
+ try {
+ for(Resource resource : domain.getResourceSet().getResources()) {
+ EObject eObjectOfMarker = resource.getEObject(uri.fragment());
+ if(eObjectOfMarker != null) {
+ return eObjectOfMarker;
+ }
+ }
+ } catch (WrappedException e) {
+ }
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
index 4eb8e552ddf..40a40994afd 100644
--- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
+++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/resource/ModelSet.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.resource;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -44,9 +43,12 @@ import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
* <li>Finally, call save()</li>
* </ul>
*
+ * Please note that indirectly referenced models are loaded on demand. If a
+ * model contains a cross reference towards another model (e.g. an import in
+ * case of UML) the referenced resource does not appear initially in the set.
+ * However, it is added once the referenced model is resolved.
*
- *
- * TODO Modifiy ModelSetSnippet in order to inform them of model addition.
+ * TODO Modify ModelSetSnippet in order to inform them of model addition.
*
* @author cedric dumoulin
*
@@ -79,7 +81,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Register the specified model under its associated key.
- * The key is defined in the model itself. It is ussually the model type from
+ * The key is defined in the model itself. It is usually the model type from
* (ModelPackage.eCONTENT_TYPE).
*
* @param model
@@ -109,13 +111,14 @@ public class ModelSet extends ResourceSetImpl {
* @param key
* the key
* @return the model
- * @throws NotFoundException If no model is registered under the key.
+ * @throws NotFoundException
+ * If no model is registered under the key.
*/
public IModel getModelChecked(String key) throws NotFoundException {
IModel model = models.get(key);
- if( model == null )
+ if(model == null)
throw new NotFoundException("Can't find model for identifier '" + key + "'.");
-
+
return model;
}
@@ -125,11 +128,11 @@ public class ModelSet extends ResourceSetImpl {
* @return the transactional editing domain
*/
public TransactionalEditingDomain getTransactionalEditingDomain() {
-// transactionalEditingDomain = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(this);
+ // transactionalEditingDomain = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(this);
transactionalEditingDomain = WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(this);
if(transactionalEditingDomain == null) {
-// transactionalEditingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(this);
+ // transactionalEditingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(this);
transactionalEditingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(this);
// What for?
transactionalEditingDomain.setID("SharedEditingDomain"); //$NON-NLS-1$
@@ -141,7 +144,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @return the filenameWithoutExtension
*/
- protected IPath getFilenameWithoutExtension() {
+ public IPath getFilenameWithoutExtension() {
return filenameWithoutExtension;
}
@@ -200,13 +203,13 @@ public class ModelSet extends ResourceSetImpl {
// Walk all registered models
for(String modelId : modelIdentifiers) {
IModel model = getModel(modelId);
-
+
// Load models using the default path
model.createModel(filenameWithoutExtension);
}
// call snippets to allow them to do their stuff
-// snippets.modelsAdded(modelIdentifiers);
+ // snippets.modelsAdded(modelIdentifiers);
}
/**
@@ -218,7 +221,8 @@ public class ModelSet extends ResourceSetImpl {
* @param file
* the file
* @return the i model
- * @throws BadStateException If the global path is not specified.
+ * @throws BadStateException
+ * If the global path is not specified.
* @returns The loaded model.
*/
public IModel loadModel(String modelIdentifier) throws BadStateException {
@@ -237,19 +241,19 @@ public class ModelSet extends ResourceSetImpl {
* @param file
* the file
* @return the i model
- * @throws ModelException
+ * @throws ModelException
* @returns The loaded model.
* @deprecated Use {@link #importModel(ModelIdentifier, IFile)}
*/
public IModel loadModel(String modelIdentifier, IFile file) throws ModelException {
importModels(new ModelIdentifiers(modelIdentifier), file);
-
+
return getModel(modelIdentifier);
}
/**
- * Load all the associated models from an handle on one of the associated file.
+ * Load all the associated models from a handle on one of the associated file.
*
* @param file
* The file to load (no matter the extension)
@@ -288,9 +292,12 @@ public class ModelSet extends ResourceSetImpl {
* Import specified models into the ModelSet. The models are imported using the specified IFile.
* After import, the models are associated with the ModelSet Path.
*
- * @param modelIdentifiers The model to import from the specified IFile.
- * @param file The IFile used to import the model.
- * @throws ModelException If an error occur during import.
+ * @param modelIdentifiers
+ * The model to import from the specified IFile.
+ * @param file
+ * The IFile used to import the model.
+ * @throws ModelException
+ * If an error occur during import.
*/
public void importModels(ModelIdentifiers modelIdentifiers, IFile file) throws ModelException {
@@ -301,7 +308,7 @@ public class ModelSet extends ResourceSetImpl {
// Load models using the default path
model.importModel(path);
- if( filenameWithoutExtension != null)
+ if(filenameWithoutExtension != null)
model.changeModelPath(filenameWithoutExtension);
}
}
@@ -315,13 +322,13 @@ public class ModelSet extends ResourceSetImpl {
* the model identifier
* @param file
* the file
- * @throws ModelException
+ * @throws ModelException
* @returns The loaded model.
*/
public IModel importModel(String modelIdentifier, IFile file) throws ModelException {
importModels(new ModelIdentifiers(modelIdentifier), file);
-
+
return getModel(modelIdentifier);
}
@@ -330,18 +337,18 @@ public class ModelSet extends ResourceSetImpl {
*/
public void createMissingModels() throws ModelException {
throw new UnsupportedOperationException("Not yet implemented");
-
+
}
-
+
/**
* Load models that are not already created or loaded.
*/
public void loadMissingModels() throws ModelException {
throw new UnsupportedOperationException("Not yet implemented");
-
+
}
-
-
+
+
/**
* Save the resources.
*
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEvent.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEvent.java
deleted file mode 100644
index cb7a4b19c38..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.lifecycleevents;
-
-import javax.imageio.spi.ServiceRegistry;
-
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeSaveEvent extends DoSaveEvent {
-
- /**
- * Constructor.
- *
- * @param serviceRegistry
- * @param multiDiagramEditor
- */
- public FakeSaveEvent() {
- super(null, null);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEventListener.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEventListener.java
deleted file mode 100644
index 8454163686d..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/FakeSaveEventListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.lifecycleevents;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeSaveEventListener implements ISaveEventListener {
-
- List<DoSaveEvent> receivedEvents = new ArrayList<DoSaveEvent>();
-
- /**
- * @see org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener#doSave(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)
- *
- * @param event
- */
- public void doSave(DoSaveEvent event) {
- receivedEvents.add(event);
-
- }
-
- /**
- * @see org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener#doSaveAs(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)
- *
- * @param event
- */
- public void doSaveAs(DoSaveEvent event) {
- receivedEvents.add(event);
-
- }
-
- /**
- * Return true if the event has been received.
- * @param event
- * @return
- */
- public boolean isEventReceived(DoSaveEvent event) {
- return receivedEvents.contains(event);
- }
-
-
- /**
- * @return the receivedEvents
- */
- public List<DoSaveEvent> getReceivedEvents() {
- return receivedEvents;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/LifeCycleEventsProviderTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/LifeCycleEventsProviderTest.java
deleted file mode 100644
index 1c1084236a9..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/LifeCycleEventsProviderTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.lifecycleevents;
-
-import junit.framework.TestCase;
-
-
-/**
- * @author cedric dumoulin
- *
- */
-public class LifeCycleEventsProviderTest extends TestCase {
-
- /**
- * Object under test.
- */
- protected LifeCycleEventsProvider eventProvider;
-
- /**
- * @see junit.framework.TestCase#setUp()
- *
- * @throws Exception
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- eventProvider = new LifeCycleEventsProvider();
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#addDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testAddSaveListener() {
-
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addDoSaveListener(listener);
- } catch (Exception e) {
- fail("Add listener");
- }
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#removeDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testRemoveSaveListener() {
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addDoSaveListener(listener);
- eventProvider.removeDoSaveListener(listener);
- } catch (Exception e) {
- fail("Remove listener");
- }
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#addAboutToDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testAddAboutToSaveListener() {
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addAboutToDoSaveListener(listener);
- } catch (Exception e) {
- fail("Add listener");
- }
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#removeAboutToDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testRemoveAboutToSaveListener() {
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addAboutToDoSaveListener(listener);
- eventProvider.removeAboutToDoSaveListener(listener);
- } catch (Exception e) {
- fail("Remove listener");
- }
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#addPostDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testAddPostSaveListener() {
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addPostDoSaveListener(listener);
- } catch (Exception e) {
- fail("Add listener");
- }
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#removePostDoSaveListener(org.eclipse.papyrus.core.lifecycleevents.ISaveEventListener)}.
- */
- public void testRemovePostSaveListener() {
- ISaveEventListener listener = new FakeSaveEventListener();
-
- try {
- eventProvider.addPostDoSaveListener(listener);
- eventProvider.removePostDoSaveListener(listener);
- } catch (Exception e) {
- fail("Remove listener");
- }
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireAboutToSaveEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addAboutToDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireAboutToDoSaveEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireAboutToDoSaveAsEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireAboutToSaveAsEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addAboutToDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireAboutToDoSaveAsEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireDoSaveEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireSaveEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireDoSaveEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireDoSaveAsEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireSaveAsEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireDoSaveAsEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFirePostSaveEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addPostDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.firePostDoSaveEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#firePostDoSaveAsEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFirePostSaveAsEvent() {
- FakeSaveEventListener listener = new FakeSaveEventListener();
-
- eventProvider.addPostDoSaveListener(listener);
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.firePostDoSaveAsEvent(event);
-
- assertTrue("event received", listener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireAllSaveEvent() {
- FakeSaveEventListener preListener = new FakeSaveEventListener();
- FakeSaveEventListener listener = new FakeSaveEventListener();
- FakeSaveEventListener postListener = new FakeSaveEventListener();
-
- eventProvider.addAboutToDoSaveListener(preListener);
- eventProvider.addDoSaveListener(listener);
- eventProvider.addPostDoSaveListener(postListener);
-
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireAllDoSaveEvent(event);
-
- assertTrue("event received", preListener.isEventReceived(event) );
- assertTrue("event received", listener.isEventReceived(event) );
- assertTrue("event received", postListener.isEventReceived(event) );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.LifeCycleEventsProvider#fireAllDoSaveAsEvent(org.eclipse.papyrus.core.lifecycleevents.DoSaveEvent)}.
- */
- public void testFireAllSaveAsEvent() {
- FakeSaveEventListener preListener = new FakeSaveEventListener();
- FakeSaveEventListener listener = new FakeSaveEventListener();
- FakeSaveEventListener postListener = new FakeSaveEventListener();
-
- eventProvider.addAboutToDoSaveListener(preListener);
- eventProvider.addDoSaveListener(listener);
- eventProvider.addPostDoSaveListener(postListener);
-
- DoSaveEvent event = new FakeSaveEvent();
- eventProvider.fireAllDoSaveAsEvent(event);
-
- assertTrue("event received", preListener.isEventReceived(event) );
- assertTrue("event received", listener.isEventReceived(event) );
- assertTrue("event received", postListener.isEventReceived(event) );
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/SaveAndDirtyServiceTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/SaveAndDirtyServiceTest.java
deleted file mode 100644
index 8fcd273c236..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/lifecycleevents/SaveAndDirtyServiceTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 LIFL & CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.core.lifecycleevents;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author dumoulin
- *
- */
-public class SaveAndDirtyServiceTest {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#doSave(org.eclipse.core.runtime.IProgressMonitor)}.
- */
- @Test
- public void testDoSave() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#doSaveAs()}.
- */
- @Test
- public void testDoSaveAs() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#isDirty()}.
- */
- @Test
- public void testIsDirty() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#isSaveAsAllowed()}.
- */
- @Test
- public void testIsSaveAsAllowed() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#isSaveOnCloseNeeded()}.
- */
- @Test
- public void testIsSaveOnCloseNeeded() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#registerIsaveablePart(org.eclipse.ui.ISaveablePart)}.
- */
- @Test
- public void testRegisterIsaveablePart() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService#removeIsaveablePart(org.eclipse.ui.ISaveablePart)}.
- */
- @Test
- public void testRemoveIsaveablePart() {
- fail("Not yet implemented");
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ComposedServiceTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ComposedServiceTest.java
deleted file mode 100644
index 18beaff614f..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ComposedServiceTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class ComposedServiceTest {
-
- private FakeComposedService masterService;
-
-
- @Before
- public void setUp() throws Exception {
- masterService = new FakeComposedService();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testAddServicePart() {
- FakeComposedServicePartA partA = new FakeComposedServicePartA();
- FakeComposedServicePartB partB = new FakeComposedServicePartB();
-
- masterService.addServicePart(partA);
- masterService.addServicePart(partB);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
- }
-
- @Test
- public void testRemoveServicePart() {
- FakeComposedServicePartA partA = new FakeComposedServicePartA();
- FakeComposedServicePartB partB = new FakeComposedServicePartB();
-
- masterService.addServicePart(partA);
- masterService.addServicePart(partB);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
- masterService.removeServicePart(partA);
- assertFalse("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
- }
-
- /**
- * Test that the parts registered to the ServiceRegistry are automaticly
- * registered to there associated main service when registry is started.
- * @throws ServiceException
- */
- @Test
- public void testPartAutomaticRegistration() throws ServiceException {
-
- ServicesRegistry serviceRegistry = new ServicesRegistry();
-
- // Register services
- serviceRegistry.add(new ComposedServiceDescriptor());
- serviceRegistry.add(new ServicePartADescriptor());
- serviceRegistry.add(new ServicePartBDescriptor());
-
- // start registry
- serviceRegistry.startRegistry();
-
- // Check if connected
- FakeComposedService masterService = serviceRegistry.getService(FakeComposedService.class);
- FakeComposedServicePartA partA = serviceRegistry.getService( FakeComposedServicePartA.class);
- FakeComposedServicePartB partB = serviceRegistry.getService( FakeComposedServicePartB.class);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertNotNull("master service found", masterService);
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
-
- }
-
-
- /* ***************************** */
-
- /**
- * A descriptor
- * @author dumoulin
- *
- */
- public class ServicePartADescriptor extends ServiceDescriptor {
-
-
- public ServicePartADescriptor() {
- super(FakeComposedServicePartA.class, FakeComposedServicePartA.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
- /**
- * A descriptor
- * @author dumoulin
- *
- */
- public class ServicePartBDescriptor extends ServiceDescriptor {
-
-
- public ServicePartBDescriptor() {
- super(FakeComposedServicePartB.class, FakeComposedServicePartB.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
- /**
- * A descriptor
- * @author dumoulin
- *
- */
- public class ComposedServiceDescriptor extends ServiceDescriptor {
-
-
- public ComposedServiceDescriptor() {
- super(FakeComposedService.class, FakeComposedService.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedService.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedService.java
deleted file mode 100644
index 6e6bd9c2245..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedService.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-
-
-/**
- * A fake composed service for testing purpose.
- *
- * @author cedric dumoulin
- *
- */
-public class FakeComposedService extends ComposedService<FakeComposedServicePart> {
-
- /**
- * Call the same method on all associated service parts.
- */
- public void walkService() {
-
- for( FakeComposedServicePart servicePart : serviceParts )
- {
- servicePart.walkService();
- }
- }
-
- @Override
- public void init(ServicesRegistry servicesRegistry) throws ServiceException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void startService() throws ServiceException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void disposeService() throws ServiceException {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePart.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePart.java
deleted file mode 100644
index 6a46e930297..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePart.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * A fake composed service part for testing purpose.
- * @author cedric dumoulin
- *
- */
-public class FakeComposedServicePart extends ComposedServicePart<FakeComposedService> {
-
-
- public FakeComposedServicePart() {
- super(FakeComposedService.class);
- }
-
- /**
- * A common method.
- */
- public void walkService() {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartA.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartA.java
deleted file mode 100644
index b079ae71848..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartA.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeComposedServicePartA extends FakeComposedServicePart {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartB.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartB.java
deleted file mode 100644
index a22bfbb3ab6..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeComposedServicePartB.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeComposedServicePartB extends FakeComposedServicePart {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeService.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeService.java
deleted file mode 100644
index e346d1f536e..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * Fake service for testing purpose.
- *
- * @author cedric dumoulin
- *
- */
-public class FakeService implements IService {
-
-
- static public TestTrace trace = new TestTrace();
-
- static int count = 0;
-
- public String name = "name" + count++;
-
-
- /**
- *
- * Constructor.
- *
- */
- public FakeService() {
- trace.addTrace(name, "create");
- }
-
- /**
- * Constructor.
- *
- * @param name
- */
- public FakeService(String name) {
- this.name = name;
- trace.addTrace(name, "create");
- }
-
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return the trace
- */
- static public TestTrace getTrace() {
- return trace;
- }
-
-
- /**
- * @param trace the trace to set
- */
- public void setTrace(TestTrace trace) {
- this.trace = trace;
- }
-
- public void init(ServicesRegistry servicesRegistry) {
- trace.addTrace(name, "init", servicesRegistry);
- }
-
- public void startService() {
- trace.addTrace(name, "start");
- }
-
- public void disposeService() {
- trace.addTrace(name, "dispose");
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeServiceFactory.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeServiceFactory.java
deleted file mode 100644
index 02478d48a1a..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeServiceFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * Fake service factory for testing purpose.
- *
- * @author cedric dumoulin
- *
- */
-public class FakeServiceFactory extends FakeService implements IServiceFactory {
-
-
- /**
- *
- * Constructor.
- *
- */
- public FakeServiceFactory() {
-
- super( "factoryName" + count++ );
- }
-
- /**
- * Constructor.
- *
- * @param name
- */
- public FakeServiceFactory(String name) {
- super(name);
- }
-
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Create the service
- * @see org.eclipse.papyrus.core.services.IServiceFactory#createServiceInstance()
- *
- * @return
- */
- public Object createServiceInstance() {
- trace.addTrace(getName(), "createInstance");
- return new FakeCreatedService();
- }
-
- /**
- * Pseudo service created by the factory.
- * @author dumoulin
- *
- */
- public class FakeCreatedService {
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeWithRequiredServiceFactory.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeWithRequiredServiceFactory.java
deleted file mode 100644
index f5df3d184c1..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/FakeWithRequiredServiceFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-/**
- * Fake service factory for testing purpose.
- * This service require the
- *
- * @author cedric dumoulin
- *
- */
-public class FakeWithRequiredServiceFactory extends FakeServiceFactory implements IServiceFactory {
-
-
- /**
- *
- * Constructor.
- *
- */
- public FakeWithRequiredServiceFactory() {
-
- super( "factoryName" + count++ );
- }
-
- /**
- * Constructor.
- *
- * @param name
- */
- public FakeWithRequiredServiceFactory(String name) {
- super(name);
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.core.services.FakeService#init(org.eclipse.papyrus.core.services.ServicesRegistry)
- *
- * @param servicesRegistry
- */
- @Override
- public void init(ServicesRegistry servicesRegistry) {
-
- trace.addTrace(name, "init");
- Object foundService = null;
- try {
- foundService = servicesRegistry.getService("C");
- } catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- trace.addTrace(name, "initEnd", foundService);
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA.java
deleted file mode 100644
index 7112bdbe2f3..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ServiceA implements IService {
-
- public enum TraceKind {
- init, start, dispose
- };
-
- static List<TraceKind> trace = new ArrayList<TraceKind>();
-
- static List<String> nametrace = new ArrayList<String>();
-
-
-
- static public TraceKind getEvent(int index) {
- return trace.get(index);
- }
-
- static public String getTraceName(int index) {
- return nametrace.get(index);
- }
-
- static public void resetTrace() {
- trace.clear();
- nametrace.clear();
- }
-
- public void init(ServicesRegistry servicesRegistry) {
- trace.add(TraceKind.init);
- nametrace.add(this.getClass().getSimpleName());
-
- }
-
- public void startService() {
- trace.add(TraceKind.start);
- nametrace.add(this.getClass().getSimpleName());
-
- }
-
- public void disposeService() {
- trace.add(TraceKind.dispose);
- nametrace.add(this.getClass().getSimpleName());
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA10.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA10.java
deleted file mode 100644
index a36eb59ce2f..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceA10.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-public class ServiceA10 extends ServiceA {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceB.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceB.java
deleted file mode 100644
index c8db40311b6..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceB.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-public class ServiceB extends ServiceA {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceC.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceC.java
deleted file mode 100644
index 31276d53126..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServiceC.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-public class ServiceC extends ServiceA {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicePojoA.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicePojoA.java
deleted file mode 100644
index 5602c3c6e12..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicePojoA.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.papyrus.core.services;
-
-
-public class ServicePojoA extends ServiceA {
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicesRegistryTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicesRegistryTest.java
deleted file mode 100644
index 252a253906e..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/ServicesRegistryTest.java
+++ /dev/null
@@ -1,733 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.papyrus.core.services.FakeServiceFactory.FakeCreatedService;
-import org.eclipse.papyrus.core.services.ServiceA.TraceKind;
-
-
-/**
- * @author dumoulin
- *
- */
-public class ServicesRegistryTest extends TestCase {
-
- /** The registry to test */
- ServicesRegistry servicesRegistry;
-
- ServiceDescriptor serviceADesc = new LazyServiceADescriptor();
-
- ServiceDescriptor serviceA10Desc = new LazyServiceA10Descriptor();
-
- ServiceDescriptor serviceBDesc = new LazyServiceBDescriptor();
-
- ServiceDescriptor serviceCDesc = new ServiceCDescriptor();
-
- ServiceDescriptor servicePojoADesc = new LazyServicePojoADescriptor();
-
- public ServicesRegistryTest(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- servicesRegistry = new ServicesRegistry();
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.services.ServicesRegistry#add(org.eclipse.papyrus.core.services.ServiceDescriptor)} .
- * @throws ServiceMultiException
- */
- public void testAdd() throws ServiceMultiException {
-
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
- // Test entries creation
-// try {
-// assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
-// assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
-// assertFalse("serviceC stopped", servicesRegistry.isStarted(serviceCDesc.getKey()));
-// assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
-// } catch (ServiceNotFoundException e) {
-// fail("Service should exist." + e.getMessage());
-// }
-
- // Test startup
- servicesRegistry.startRegistry();
-
- // Test always started
- try {
- assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
- assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
- assertEquals("serviceC state", ServiceState.started, servicesRegistry.serviceState(serviceCDesc.getKey()));
- assertTrue("serviceC started", servicesRegistry.isStarted(serviceCDesc.getKey()));
- assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
- } catch (ServiceNotFoundException e) {
- fail("Service should exist.");
- }
-
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.services.ServicesRegistry#getService(java.lang.Object)}.
- *
- * @throws ServiceException
- */
- public void testGetService() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
-
- servicesRegistry.startRegistry();
-
- // Test lazy service
- Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
- assertNotNull("service created", serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
- Object serviceA2 = servicesRegistry.getService(serviceADesc.getKey());
- assertEquals("Second retrieve get the same service", serviceA, serviceA2);
-
- // test startup service
- Object serviceC = servicesRegistry.getService(serviceCDesc.getKey());
- assertNotNull("service created", serviceC);
- assertEquals("right class", ServiceC.class, serviceC.getClass());
-
- Object serviceC2 = servicesRegistry.getService(serviceCDesc.getKey());
- assertEquals("Second retrieve get the same service", serviceC, serviceC2);
-
- // test pojo service
- Object servicePojo = servicesRegistry.getService(servicePojoADesc.getKey());
- assertNotNull("service created", servicePojo);
- assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
-
- Object servicePojo2 = servicesRegistry.getService(servicePojoADesc.getKey());
- assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
-
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.services.ServicesRegistry#getService(java.lang.Object)}.
- *
- * @throws ServiceException
- */
- public void testGetServiceByClass() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
-
- servicesRegistry.startRegistry();
-
- // Test lazy service
- ServiceA serviceA = servicesRegistry.getService(ServiceA.class);
- assertNotNull("service created", serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
- ServiceA serviceA2 = servicesRegistry.getService(ServiceA.class);
- assertEquals("Second retrieve get the same service", serviceA, serviceA2);
-
- // test startup service
- ServiceC serviceC = servicesRegistry.getService(ServiceC.class);
- assertNotNull("service created", serviceC);
- assertEquals("right class", ServiceC.class, serviceC.getClass());
-
- // test pojo service
- ServicePojoA servicePojo = servicesRegistry.getService(ServicePojoA.class);
- assertNotNull("service created", servicePojo);
- assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
-
- Object servicePojo2 = servicesRegistry.getService(ServicePojoA.class);
- assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
-
-
- }
-
- /**
- * Try to register 2 services under the same name, but with different priorities.
- *
- * @throws ServiceException
- */
- public void testPriority() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceA10Desc);
- servicesRegistry.add(serviceBDesc);
-
- // Test creation
-// try {
-// assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
-// assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
-// } catch (ServiceNotFoundException e) {
-// fail("Service should exist.");
-// }
-
- servicesRegistry.startRegistry();
-
- Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
-
- assertNotNull("Service created", serviceA);
- assertEquals("right class", ServiceA10.class, serviceA.getClass());
-
-
- }
-
- /**
- * Test add for a direct instance of service.
- *
- * @throws ServiceException
- */
- public void testAddDirectInstance() throws ServiceException {
- IService instanciatedService = new ServiceA();
- String key = instanciatedService.getClass().getName();
-
- servicesRegistry.add(key, 1, instanciatedService);
-
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(serviceBDesc);
-
- servicesRegistry.startRegistry();
-
- Object serviceA = servicesRegistry.getService(key);
-
- assertNotNull("Service created", serviceA);
- assertEquals("right object", instanciatedService, serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
-
- }
-
- /**
- * Test life cycle for directly registered services
- * @throws ServiceException
- */
- public void testCallsOrder() throws ServiceException {
- // Register services as STARTUP !
- servicesRegistry.add(ServiceA.class, 1, new ServiceA() );
- // Lazy - generate no trace
- servicesRegistry.add(ServiceB.class, 1, new ServiceB(), ServiceStartKind.LAZY);
- servicesRegistry.add(ServiceC.class, 1, new ServiceC());
- servicesRegistry.add(ServicePojoA.class, 1, new ServicePojoA());
-
-
- ServiceA.resetTrace();
- servicesRegistry.startRegistry();
-
- // Check orders
- //
- int i=0;
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
- // Now, start lazy service
- ServiceB service = servicesRegistry.getService(ServiceB.class);
- assertNotNull("service found", service);
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
-
- // Check dispose
- servicesRegistry.disposeRegistry();
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-
- //
- }
-
- /**
- * Test life cycle for services registered wih descriptors
- * @throws ServiceException
- */
- public void testCallsOrderForDescriptors() throws ServiceException {
- // Register services as STARTUP !
- // Lazy - generate no trace
- servicesRegistry.add( new LazyServiceBDescriptor() );
- servicesRegistry.add( new ServiceCDescriptor());
-
-
- ServiceA.resetTrace();
- servicesRegistry.startRegistry();
-
- // Check orders
- //
- int i=0;
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
- // Now, start lazy service
- ServiceB service = (ServiceB)servicesRegistry.getService(ServiceB.class.getName());
- assertNotNull("service found", service);
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
-
- // Check dispose
- servicesRegistry.disposeRegistry();
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-// assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-
- //
- }
-
- /**
- * Test the start order for services of type Start et Service
- * @throws ServiceException
- */
- public void testStartDependantOrder() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
- String D = "D";
- String E = "E";
-// String F = "F";
-
- // Create services E --> D --> C --> B --> A
- FakeService.getTrace().reset();
-
- servicesRegistry.add( new ServiceDesc( E, ServiceStartKind.STARTUP, Arrays.asList(D) ));
- servicesRegistry.add( new ServiceDesc( D, ServiceStartKind.STARTUP, Arrays.asList(C) ));
- servicesRegistry.add( new ServiceDesc( C, ServiceStartKind.STARTUP, Arrays.asList(B) ));
- servicesRegistry.add( new ServiceDesc( B, ServiceStartKind.STARTUP, Arrays.asList(A) ));
- servicesRegistry.add( new ServiceDesc( A, ServiceStartKind.STARTUP ));
-// servicesRegistry.add( new ServiceDesc( F, ServiceStartKind.STARTUP, Arrays.asList(E) ));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertTrue("service started", servicesRegistry.isStarted(A));
- assertTrue("service started", servicesRegistry.isStarted(B));
- assertNotSame("services are different", servicesRegistry.getService(A), servicesRegistry.getService(B));
-
- // Get names of created services
- String nameA = ((FakeService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeService)servicesRegistry.getService(C)).getName();
- String nameD = ((FakeService)servicesRegistry.getService(D)).getName();
- String nameE = ((FakeService)servicesRegistry.getService(E)).getName();
-// String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // order should be A, B, C, D, E
- TestTrace trace = FakeService.getTrace();
- int i = 0;
-// assertEquals("order", nameF + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
-
-// assertEquals("order", nameF + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
-
-// assertEquals("order", nameF + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
-
- }
-
- /**
- * Test Service Factory creation
- * @throws ServiceException
- */
- public void testServiceFactoryCreation() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
-
- // Create services
- FakeService.getTrace().reset();
-
- servicesRegistry.add( new ServiceFactoryDesc( C, ServiceStartKind.STARTUP ));
- servicesRegistry.add( new ServiceFactoryDesc( B, ServiceStartKind.STARTUP, Arrays.asList(C) ));
- servicesRegistry.add( new ServiceFactoryDesc( A, ServiceStartKind.STARTUP, Arrays.asList(B) ));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order
- // Order should be: C, B, A
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test Creation of Service Factory used with class as key.
- * @throws ServiceException
- */
- public void testServiceFactoryWithClassKey() throws ServiceException {
-
- //
- Class<?> A = ServiceA.class;
- Class<?> B = ServiceB.class;
- Class<?> C = ServiceC.class;
-
- // Specify service types as String
- String serviceClassname1 = FakeServiceFactory.class.getName();;
- String serviceClassname2 = FakeServiceFactory.class.getName();
- String serviceClassname3 = FakeServiceFactory.class.getName();
-
- // Create services
- FakeService.getTrace().reset();
-
- servicesRegistry.add( new ServiceFactoryDesc( C, serviceClassname3, ServiceStartKind.STARTUP ));
- servicesRegistry.add( new ServiceFactoryDesc( B, serviceClassname2, ServiceStartKind.STARTUP , Arrays.asList(C.getName()) ));
- servicesRegistry.add( new ServiceFactoryDesc( A, serviceClassname1, ServiceStartKind.STARTUP , Arrays.asList(B.getName()) ));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // Order should be
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test Service Factory creation order.
- * One of the factory try to get the required service from its init() method.
- * @throws ServiceException
- */
- public void testServiceFactoryWithRequiredInInit() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
-
- // Create services C --> A --> B
- FakeService.getTrace().reset();
-
- // FakeWithRequiredServiceFactory try to retrieve service "C"
- servicesRegistry.add( new ServiceFactoryDesc( B, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(C) ));
- servicesRegistry.add( new ServiceFactoryDesc( A, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(B, C) ));
- servicesRegistry.add( new ServiceFactoryDesc( C, FakeServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1 ));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order
- // Order should be: C, B, A
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- assertEquals("value", servicesRegistry.getService(C), trace.getValue(i));
- assertEquals("order", nameB + ",initEnd", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",initEnd", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
-// assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
-// assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test {@link ServicesRegistry#startServicesByClassKeys(List)}.
- * Check that services are started.
- *
- * @throws ServiceException
- */
- public void testStartService() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
- String D = "D";
- String E = "E";
-
- // Create services E --> D --> C --> B --> A
- FakeService.getTrace().reset();
-
- servicesRegistry.add( new ServiceDesc( E, ServiceStartKind.STARTUP, Arrays.asList(D) ));
- servicesRegistry.add( new ServiceDesc( D, ServiceStartKind.STARTUP, Arrays.asList(C) ));
- servicesRegistry.add( new ServiceDesc( C, ServiceStartKind.STARTUP, Arrays.asList(A, B) ));
- servicesRegistry.add( new ServiceDesc( B, ServiceStartKind.STARTUP, Arrays.asList(A) ));
- servicesRegistry.add( new ServiceDesc( A, ServiceStartKind.STARTUP ));
-
- // Start services
- servicesRegistry.startServices(Arrays.asList(C));
-
- // check services
- assertTrue("service started", servicesRegistry.isStarted(A));
- assertTrue("service started", servicesRegistry.isStarted(B));
- assertTrue("service started", servicesRegistry.isStarted(C));
-
- // Get names of created services
- String nameA = ((FakeService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeService)servicesRegistry.getService(C)).getName();
-// String nameD = ((FakeService)servicesRegistry.getService(D)).getName();
-// String nameE = ((FakeService)servicesRegistry.getService(E)).getName();
-// String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // order should be A, B, C
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
-// assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
-// assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
-// assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
-// assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
-// assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
-// assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
-
- }
-
- /* **************************************** */
-
-
-
-
-
- /**
- * General purpose descriptor.
- */
- public class ServiceDesc extends ServiceDescriptor {
-
-
- public ServiceDesc( String key, ServiceStartKind startKind) {
- super(key, FakeService.class.getName(), startKind, 1 );
- }
-
- public ServiceDesc( String key, ServiceStartKind startKind, List<String> requiredService) {
- super(key, FakeService.class.getName(), startKind, 1, requiredService );
- }
- }
-
- /**
- * General purpose descriptor.
- */
- public class ServiceFactoryDesc extends ServiceDescriptor {
-
-
- public ServiceFactoryDesc( String key, ServiceStartKind startKind) {
- super(key, FakeServiceFactory.class.getName(), startKind, 1 );
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc( String key, ServiceStartKind startKind, List<String> requiredService) {
- super(key, FakeServiceFactory.class.getName(), startKind, 1, requiredService );
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
- /**
- * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
- * Constructor.
- *
- * @param key
- * @param startKind
- * @param requiredService
- */
- public ServiceFactoryDesc( Class<?> key, String classname, ServiceStartKind startKind, List<String> requiredService) {
- super(key, classname, startKind, 1, requiredService );
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
- /**
- * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
- * Constructor.
- *
- * @param key
- * @param startKind
- * @param requiredService
- */
- public ServiceFactoryDesc( Class<?> key, String classname, ServiceStartKind startKind) {
- super(key, classname, startKind, 1 );
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
- super(key, serviceClassname, serviceStartKind, priority, requiredServices);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
- super(key, serviceClassname, serviceStartKind, priority);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
- }
-
- /**
- *
- * @author dumoulin
- *
- */
- public class LazyServiceADescriptor extends ServiceDescriptor {
-
-
- public LazyServiceADescriptor() {
- super(ServiceA.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class LazyServiceA10Descriptor extends ServiceDescriptor {
-
-
- public LazyServiceA10Descriptor() {
- super(ServiceA.class.getName(), ServiceA10.class.getName(), ServiceStartKind.LAZY, 10);
- }
- }
-
- public class LazyServiceBDescriptor extends ServiceDescriptor {
-
-
- public LazyServiceBDescriptor() {
- super(ServiceB.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class ServiceCDescriptor extends ServiceDescriptor {
-
-
- public ServiceCDescriptor() {
- super(ServiceC.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
- public class LazyServicePojoADescriptor extends ServiceDescriptor {
-
-
- public LazyServicePojoADescriptor() {
- super(ServicePojoA.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class PojoServiceDescriptor extends ServiceDescriptor {
-
-
- public PojoServiceDescriptor() {
- super(Object.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/TestTrace.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/TestTrace.java
deleted file mode 100644
index 66feb56a032..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/core/services/TestTrace.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.core.services;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * A class used to record traces for tests
- *
- * @author cedric dumoulin
- *
- */
-public class TestTrace {
-
- public List<TraceRecord>traces = new ArrayList<TraceRecord>();
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String trace) {
- addTrace(null, trace, null);
- }
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String name, String trace) {
- addTrace(name, trace, null);
- }
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String name, String trace, Object value) {
- traces.add(new TraceRecord( name, trace, value));
- }
-
- /**
- * Return the name and the trace in one concatenated string ("name,trace").
- * @param i Index of the requested trace
- * @return
- */
- public String getNameTrace(int i) {
- return traces.get(i).getNameTrace();
- }
-
- /**
- * Get the value
- * @param i
- * @return
- */
- public Object getValue(int i) {
- return traces.get(i).value;
- }
-
- /**
- * Return true if the trace contains the specified events.
- * @return
- */
- public boolean contains( String name, String trace) {
-
- return indexOfNameTrace(name, trace) >= 0;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOf(String name, String trace, Object value) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) && trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfNameTrace(String name, String trace) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) && trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfTrace(String trace) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfName(String name) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Reset the trace.
- */
- public void reset() {
- traces.clear();
- }
-
-
- /**
- * @return the traces
- */
- public List<TraceRecord> getTraces() {
- return traces;
- }
-
- /**
- * A Record of the trace.
- */
- public class TraceRecord {
- public String name;
- public String trace;
- public Object value;
- /**
- * Constructor.
- *
- * @param name
- * @param trace
- * @param value
- */
- public TraceRecord(String name, String trace, Object value) {
- this.name = name;
- this.trace = trace;
- this.value = value;
- }
-
- /**
- *
- * @return
- */
- public String getNameTrace() {
- // TODO Auto-generated method stub
- return name + "," + trace;
- }
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/AbstractModelWithSharedResourceTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/AbstractModelWithSharedResourceTest.java
deleted file mode 100644
index 26782b53924..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/AbstractModelWithSharedResourceTest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.resource;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.papyrus.resource.AbstractModelWithSharedResource.ModelKind;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * Run as "JUnit Plugin-Test"
- *
- * @author cedric dumoulin
- *
- */
-public class AbstractModelWithSharedResourceTest {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test that the resource is created only once.
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#createModel(org.eclipse.core.runtime.IPath)}.
- */
- @Test
- public void testCreateModel() {
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- // Create models with different key, but use same extension (default from FakeModelWithSharedResource)
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates
- modelSet.createsModels(model1File);
-
- // Do check
- assertNotNull( "resource created", model1.getResouce() );
- assertNotNull( "resource created", model2.getResouce() );
- assertEquals("Resource is shared", model1.getResouce(), model2.getResouce());
-
-
- }
-
- /**
- * Create and save models.
- * @throws IOException
- * @throws CoreException
- */
- private void createAndSave(String model1Key, String model2Key) throws IOException, CoreException {
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- if(!p.exists())
- p.create(new NullProgressMonitor());
- p.open(new NullProgressMonitor());
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates and save
-
- modelSet.createsModels(model1File);
- model1.getResouce().setModified(true);
- modelSet.save(new NullProgressMonitor());
- modelSet.unload();
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#loadModel(org.eclipse.core.runtime.IPath)}.
- * @throws CoreException
- * @throws IOException
- * @throws ModelMultiException
- */
- @Test
- public void testLoadModelIPath() throws IOException, CoreException, ModelMultiException {
-
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- createAndSave(model1Key, model2Key);
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates
- modelSet.loadModels(model1File);
-
- // Do check
- assertNotNull( "resource loaded", model1.getResouce() );
- assertNotNull( "resource loaded", model2.getResouce() );
- assertEquals("Resource is shared", model1.getResouce(), model2.getResouce());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#saveModel()}.
- * @throws IOException
- * @throws CoreException
- */
- @Test
- public void testSaveModel() throws IOException, CoreException {
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- if(!p.exists())
- p.create(new NullProgressMonitor());
- p.open(new NullProgressMonitor());
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates and save
-
- modelSet.createsModels(model1File);
- model1.getResouce().setModified(true);
- modelSet.save(new NullProgressMonitor());
-
- // Do check
- assertNotNull( "resource created", model1.getResouce() );
- assertNotNull( "resource created", model2.getResouce() );
- assertEquals("Resource is shared", model1.getResouce(), model2.getResouce());
- // Check weither it is save
- assertFalse("Resource is saved", model1.getResouce().isModified());
- assertFalse("Resource is saved", model2.getResouce().isModified());
- // TODO : check that it is saved only once !
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#getModelRoot()}.
- */
- @Test
- public void testGetModelRoot() {
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates
- modelSet.createsModels(model1File);
- // Add elements in both model
- EPackage p1 = EcoreFactory.eINSTANCE.createEPackage();
- model1.addModelRoot(p1);
-
- EClass c1 = EcoreFactory.eINSTANCE.createEClass();
- model2.addModelRoot(c1);
-
- // Do check
- assertEquals( "root found", p1, model1.getModelRoot() );
- assertEquals( "root found", c1, model2.getModelRoot() );
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#getModelRoot()}.
- */
- @Test
- public void testGetModelRoots() {
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates
- modelSet.createsModels(model1File);
- // Add elements in both model
- EPackage p1 = EcoreFactory.eINSTANCE.createEPackage();
- model1.addModelRoot(p1);
- EPackage p2 = EcoreFactory.eINSTANCE.createEPackage();
- model1.addModelRoot(p2);
- EPackage p3 = EcoreFactory.eINSTANCE.createEPackage();
- model1.addModelRoot(p3);
-
- EClass c1 = EcoreFactory.eINSTANCE.createEClass();
- model2.addModelRoot(c1);
- EClass c2 = EcoreFactory.eINSTANCE.createEClass();
- model2.addModelRoot(c2);
- EClass c3 = EcoreFactory.eINSTANCE.createEClass();
- model2.addModelRoot(c3);
-
- // Do check
- List<EPackage> lp = model1.getModelRoots();
- List<EClass> lc = model2.getModelRoots();
-
- assertNotNull("list exist", lp );
- assertEquals("list size", 3, lp.size());
- assertTrue("element found", lp.contains(p1));
- assertTrue("element found", lp.contains(p2));
- assertTrue("element found", lp.contains(p3));
-
- assertNotNull("list exist", lc );
- assertEquals("list size", 3, lc.size());
- assertTrue("element found", lc.contains(c1));
- assertTrue("element found", lc.contains(c2));
- assertTrue("element found", lc.contains(c3));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.AbstractModelWithSharedResource#addModelRoot(org.eclipse.emf.ecore.EObject)}.
- */
- @Test
- public void testAddModelRoot() {
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModelWithSharedResource<EPackage> model1 = new FakeModelWithSharedResource<EPackage>(ModelKind.master, model1Key, EPackage.class);
- FakeModelWithSharedResource<EClass> model2 = new FakeModelWithSharedResource<EClass>(model2Key, EClass.class);
-
- ModelSet modelSet = new ModelSet();
- modelSet.registerModel(model1);
- modelSet.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Call creates
- modelSet.createsModels(model1File);
- // Add elements in both model
- EPackage p1 = EcoreFactory.eINSTANCE.createEPackage();
- model1.addModelRoot(p1);
-
- EClass c1 = EcoreFactory.eINSTANCE.createEClass();
- model2.addModelRoot(c1);
-
- // Do check
- assertTrue("model contain element", model1.getResouce().getContents().contains(p1) );
- assertTrue("model contain element", model2.getResouce().getContents().contains(c1) );
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModel.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModel.java
deleted file mode 100644
index e632c90441b..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.resource;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeModel extends AbstractBaseModel {
-
- private String identifier;
-
- public FakeModel(String identifier) {
- this.identifier = identifier;
- }
-
- /**
- * @see org.eclipse.papyrus.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- // TODO Auto-generated method stub
- return identifier;
- }
-
- /**
- * @see org.eclipse.papyrus.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- // TODO Auto-generated method stub
- return identifier;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelManagerSnippet.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelManagerSnippet.java
deleted file mode 100644
index b994d0b25be..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelManagerSnippet.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.resource;
-
-
-/**
- * a fake {@link IModelSetSnippet} for test purpose.
- *
- * @author cedric dumoulin
- *
- */
-public class FakeModelManagerSnippet implements IModelSetSnippet {
-
- private TestTrace trace;
-
- private String name;
-
- /**
- *
- * Constructor.
- *
- * @param string
- */
- public FakeModelManagerSnippet(String name) {
- this.trace = new TestTrace();
- this.name = name;
- }
-
- /**
- *
- * Constructor.
- *
- * @param trace2
- * @param string
- */
- public FakeModelManagerSnippet(TestTrace trace, String name) {
- this.trace = trace;
- this.name = name;
- }
-
- /**
- * @see org.eclipse.papyrus.resource.IModelSetSnippet#start(org.eclipse.papyrus.resource.ModelSet)
- *
- * @param modelsManager
- */
- public void start(ModelSet modelsManager) {
- trace.addTrace(name, "start");
- }
-
- /**
- * @see org.eclipse.papyrus.resource.IModelSetSnippet#dispose(org.eclipse.papyrus.resource.ModelSet)
- *
- * @param modelsManager
- */
- public void dispose(ModelSet modelsManager) {
- trace.addTrace(name, "dispose");
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelWithSharedResource.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelWithSharedResource.java
deleted file mode 100644
index 45715ca0e55..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/FakeModelWithSharedResource.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-
-
-/**
- * @author dumoulin
- *
- */
-public class FakeModelWithSharedResource<T extends EObject> extends AbstractModelWithSharedResource<T> {
-
- private String identifier;
- private String fileExtension;
- private Class<T> expectedType;
-
- /**
- *
- * Constructor.
- *
- * @param kind
- * @param identifier
- * @param fileExtension
- * @param expectedType
- */
- public FakeModelWithSharedResource(ModelKind kind, String identifier, String fileExtension, Class<T> expectedType) {
- super(kind);
- this.identifier = identifier;
- this.expectedType = expectedType;
- this.fileExtension = fileExtension;
- }
-
- /**
- *
- * Constructor.
- *
- * @param kind
- * @param identifier
- * @param expectedType
- */
- public FakeModelWithSharedResource(ModelKind kind, String identifier, Class<T> expectedType) {
- this(kind, identifier, "di", expectedType);
- }
-
- /**
- *
- * Constructor.
- *
- * @param identifier
- * @param expectedType
- */
- public FakeModelWithSharedResource(String identifier, Class<T> expectedType) {
- this(ModelKind.slave, identifier, expectedType);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
- *
- * @param object
- * @return
- */
- @Override
- protected boolean isModelRoot(EObject object) {
- return expectedType.isInstance(object);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- return identifier;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- return fileExtension;
- }
-
- /**
- * Get the associated resource.
- * @return
- */
- public Resource getResouce() {
- return resource;
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/ModelSetTest.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/ModelSetTest.java
deleted file mode 100644
index 5ce9d95942f..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/ModelSetTest.java
+++ /dev/null
@@ -1,485 +0,0 @@
-package org.eclipse.papyrus.resource;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test for {@link ModelSet}. <br>
- * Run as "JUnit Plugin-Test"
- *
- * @author cedric dumoulin
- *
- */
-public class ModelSetTest {
-
- /**
- * Name of the plugin that is created.
- */
- final protected String PLUGIN_PROJECT_NAME = "org.eclipse.papyrus.core";
-
- /**
- *
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- *
- * @throws Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet.registerModel(IModel)} .
- */
- @Test
- public void testRegisterModel() {
- ModelSet mngr = new ModelSet();
-
- FakeModel model1 = new FakeModel("model1");
-
- mngr.registerModel(model1);
-
- assertNotNull("mngr is set", model1.getModelManager());
- assertNotNull("model is registered", mngr.getModel("model1"));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#getModel(String)} .
- */
- @Test
- public void testGetModel() {
- ModelSet mngr = new ModelSet();
-
- FakeModel model1 = new FakeModel("model1");
- FakeModel model2 = new FakeModel("model2");
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- assertNotNull("model is registered", mngr.getModel("model1"));
- assertNotNull("model is registered", mngr.getModel("model2"));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#getTransactionalEditingDomain()} .
- */
- @Test
- public void testGetTransactionalEditingDomain() {
- ModelSet mngr = new ModelSet();
-
- assertNotNull("editing domain created", mngr.getTransactionalEditingDomain());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#createsModels(IFile)} .
- */
- @Test
- public void testCreatesModels() throws IOException, CoreException {
- ModelSet mngr = new ModelSet();
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Do create
- mngr.createsModels(model1File);
-
- assertNotNull("resource created", model1.getResource());
- assertNotNull("resource created", model2.getResource());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#loadModels(IFile)} .
- *
- * @throws ModelMultiException
- */
- @Test
- public void testLoadModels() throws IOException, CoreException, ModelMultiException {
-
- // Create models so they exists
- testSave();
-
- // Now do load
- ModelSet mngr = new ModelSet();
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
- IFile model2File = p.getFile("tmp/model1." + model2Key);
-
- assertTrue("modelFile exist", model1File.exists());
- assertTrue("modelFile exist", model2File.exists());
-
- // Try to load
- mngr.loadModels(model1File);
-
- assertNotNull("resource created", model1.getResource());
- assertNotNull("resource created", model2.getResource());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#save(IProgressMonitor)} .
- */
- @Test
- public void testSave() throws CoreException, IOException {
- ModelSet mngr = new ModelSet();
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- if(!p.exists())
- p.create(new NullProgressMonitor());
- p.open(new NullProgressMonitor());
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
- IFile model2File = p.getFile("tmp/model1." + model2Key);
-
- // Do create and save
- mngr.createsModels(model1File);
- mngr.save(new NullProgressMonitor());
- //
- assertTrue("resource created", model1File.exists());
- assertTrue("resource created", model2File.exists());
- //
- assertNotNull("resource created", model1.getResource());
- assertNotNull("resource created", model2.getResource());
- }
-
- /**
- * Create some Resources for other test. This method should be called explicitly.
- *
- * @throws CoreException
- * @throws IOException
- */
- protected void createResources(String... filenames) throws CoreException, IOException {
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(PLUGIN_PROJECT_NAME);
- if(!p.exists())
- p.create(new NullProgressMonitor());
- p.open(new NullProgressMonitor());
-
- ResourceSet resourceSet = new ResourceSetImpl();
-
- for(String filename : filenames) {
- createResource(p, resourceSet, filename);
- }
-
- // Save created resources
- for(Resource resource : resourceSet.getResources()) {
- resource.save(null);
- }
-
- }
-
-
- /**
- * Create a resource.
- *
- * @param p
- * @param resourceSet
- * @param filename
- */
- private void createResource(IProject p, ResourceSet resourceSet, String filename) {
-
- // Build a valid file
- IFile file = p.getFile(filename);
-
-
- URI uri = URI.createPlatformResourceURI(file.getFullPath().toOSString(), true);
- resourceSet.createResource(uri);
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#saveAs(IPath)} .
- */
- @Test
- public void testSaveAs() throws CoreException, IOException {
- ModelSet mngr = new ModelSet();
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- if(!p.exists())
- p.create(new NullProgressMonitor());
- p.open(new NullProgressMonitor());
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Do create and save
- mngr.createsModels(model1File);
- mngr.save(new NullProgressMonitor());
-
- // Change the name
- IFile newModel1File = p.getFile("tmp/model2." + model1Key);
- IFile newModel2File = p.getFile("tmp/model2." + model2Key);
- IPath newPath = newModel1File.getFullPath();
-
- mngr.saveAs(newPath);
- // check creation
-
- assertTrue("resource created", newModel2File.exists());
- assertTrue("resource created", newModel2File.exists());
- //
- assertNotNull("resource created", model1.getResource());
- assertNotNull("resource created", model2.getResource());
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#unload()} .
- */
- @Test
- public void testUnload() {
- ModelSet mngr = new ModelSet();
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
-
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
-
- // Do create and then unload
- mngr.createsModels(model1File);
- mngr.unload();
-
- assertNull("resource unloaded", model1.getResource());
- assertNull("resource unloaded", model2.getResource());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.resource.ModelSet#addModelSetSnippet(IModelManagerSnippet)} .
- */
- @Test
- public void testAddModelSetSnippet() {
- ModelSet mngr = new ModelSet();
-
- // Add snippets
- TestTrace trace = new TestTrace();
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet1"));
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet2"));
-
- // Do create
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- IFile model1File = p.getFile("tmp/model1.ecore");
- mngr.createsModels(model1File);
-
- // Check calls
- assertTrue("snippet1 called", trace.contains("snippet1", "start"));
- assertTrue("snippet2 called", trace.contains("snippet2", "start"));
-
- }
-
- /**
- * Test that snippets are called after a call to createsModels()
- */
- @Test
- public void testSnippetCalledAfterCreateModels() {
- ModelSet mngr = new ModelSet();
-
- // Add snippets
- TestTrace trace = new TestTrace();
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet1"));
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet2"));
-
- // Do create
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- IFile model1File = p.getFile("tmp/model1.ecore");
- mngr.createsModels(model1File);
-
- // Check calls
- assertTrue("snippet1 called", trace.contains("snippet1", "start"));
- assertTrue("snippet2 called", trace.contains("snippet2", "start"));
-
- // dispose
- mngr.unload();
- // Check calls
- assertTrue("snippet1 called", trace.contains("snippet1", "dispose"));
- assertTrue("snippet2 called", trace.contains("snippet2", "dispose"));
-
- }
-
- /**
- * Test that snippets are called after a call to loadModels()
- *
- * @throws ModelMultiException
- */
- @Test
- public void testSnippetCalledAfterLoadModels() throws ModelMultiException {
-
- // force model creation
- testSnippetCalledAfterCreateModels();
-
- // now do load.
- ModelSet mngr = new ModelSet();
-
- // Add snippets
- TestTrace trace = new TestTrace();
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet1"));
- mngr.addModelSetSnippet(new FakeModelManagerSnippet(trace, "snippet2"));
-
- // Do create
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.papyrus.core");
- IFile model1File = p.getFile("tmp/model1.ecore");
- mngr.loadModels(model1File);
-
- // Check calls
- assertTrue("snippet1 called", trace.contains("snippet1", "start"));
- assertTrue("snippet2 called", trace.contains("snippet2", "start"));
-
- // dispose
- mngr.unload();
- // Check calls
- assertTrue("snippet1 called", trace.contains("snippet1", "dispose"));
- assertTrue("snippet2 called", trace.contains("snippet2", "dispose"));
-
- }
-
- /**
- * Test {@link #createResources(String...)}. This is a test methods :-)
- *
- * @throws ModelMultiException
- */
- @Test
- public void testCreateResource() throws IOException, CoreException, ModelMultiException {
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
- String model3Key = "uml";
-
- // Create models
- createResources("tmp/model1." + model1Key, "tmp/model1." + model2Key, "tmp/model1." + model3Key);
-
- // Check model creation
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(PLUGIN_PROJECT_NAME);
-
- IFile model1File = p.getFile("tmp/model1." + model1Key);
- IFile model2File = p.getFile("tmp/model1." + model2Key);
- IFile model3File = p.getFile("tmp/model1." + model3Key);
-
- assertTrue("modelFile exist", model1File.exists());
- assertTrue("modelFile exist", model2File.exists());
- assertTrue("modelFile exist", model3File.exists());
- }
-
- /**
- * Test {@link ModelSet#importModels(ModelIdentifiers, IFile)} called after {@link ModelSet#createsModels(IFile)} .
- *
- * @throws ModelException
- */
- @Test
- public void testImportAfterCreate() throws IOException, CoreException, ModelException {
-
- String model1Key = "ecore";
- String model2Key = "genmodel";
- String model3Key = "uml";
-
- // Create models
- createResources("tmp/model1." + model1Key, "tmp/model1." + model2Key, "tmp/model1." + model3Key);
-
- // Now do registration
- ModelSet mngr = new ModelSet();
-
- FakeModel model1 = new FakeModel(model1Key);
- FakeModel model2 = new FakeModel(model2Key);
- FakeModel model3 = new FakeModel(model3Key);
-
- mngr.registerModel(model1);
- mngr.registerModel(model2);
- mngr.registerModel(model3);
-
-
- // Get an handle on one of the files
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(PLUGIN_PROJECT_NAME);
- IFile createdFile = p.getFile("tmp/model2." + model1Key);
-
-
- // Try to create all models
- mngr.createsModels(createdFile);
-
- assertNotNull("resource created", model1.getResource());
- assertNotNull("resource created", model2.getResource());
- assertNotNull("resource created", model3.getResource());
-
- // Add something in the model
- model1.getResource().getContents().add(EcoreFactory.eINSTANCE.createEPackage());
- assertEquals("model1 has changed", 1, model1.getResource().getContents().size());
-
- // Try to import
- IFile importFile = p.getFile("tmp/model1." + model1Key);
- mngr.importModels(new ModelIdentifiers(model1Key, model2Key), importFile);
-
- assertNotNull("resource exist", model1.getResource());
- assertNotNull("resource exist", model2.getResource());
- assertNotNull("resource exist", model3.getResource());
-
- assertEquals("model1 has changed", 0, model1.getResource().getContents().size());
-
-
- }
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/TestTrace.java b/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/TestTrace.java
deleted file mode 100644
index 7975598d9bd..00000000000
--- a/plugins/core/org.eclipse.papyrus.core/test/org/eclipse/papyrus/resource/TestTrace.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.resource;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * A class used to record traces for tests
- *
- * @author cedric dumoulin
- *
- */
-public class TestTrace {
-
- public List<TraceRecord>traces = new ArrayList<TraceRecord>();
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String trace) {
- addTrace(null, trace, null);
- }
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String name, String trace) {
- addTrace(name, trace, null);
- }
-
- /**
- * Record a new trace.
- * @param trace
- */
- public void addTrace(String name, String trace, Object value) {
- traces.add(new TraceRecord( name, trace, value));
- }
-
- /**
- * Return true if the trace contains the specified events.
- * @return
- */
- public boolean contains( String name, String trace) {
-
- return indexOfNameTrace(name, trace) >= 0;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOf(String name, String trace, Object value) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) && trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfNameTrace(String name, String trace) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) && trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfTrace(String trace) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( trace.equals(record.trace) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Returns the index of the first occurrence of the specified elements
- * in these lists, or -1 if this list does not contain the element.
- */
- public int indexOfName(String name) {
-
- for (int i = 0; i < traces.size(); i++) {
- TraceRecord record = traces.get(i);
-
- if( name.equals(record.name) )
- return i;
- }
-
- return -1;
- }
-
- /**
- * Reset the trace.
- */
- public void reset() {
- traces.clear();
- }
-
-
- /**
- * @return the traces
- */
- public List<TraceRecord> getTraces() {
- return traces;
- }
-
- /**
- * A Record of the trace.
- */
- public class TraceRecord {
- public String name;
- public String trace;
- public Object value;
- /**
- * Constructor.
- *
- * @param name
- * @param trace
- * @param value
- */
- public TraceRecord(String name, String trace, Object value) {
- this.name = name;
- this.trace = trace;
- this.value = value;
- }
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.di.edit/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.di.edit/META-INF/MANIFEST.MF
index c098620e031..18e3a51b577 100644
--- a/plugins/core/org.eclipse.papyrus.di.edit/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.di.edit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.di.edit;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.papyrus.di.provider.DiEditPlugin$Implementation
Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.di.edit/build.properties b/plugins/core/org.eclipse.papyrus.di.edit/build.properties
index b54f31bdc1b..c216dcfb67c 100644
--- a/plugins/core/org.eclipse.papyrus.di.edit/build.properties
+++ b/plugins/core/org.eclipse.papyrus.di.edit/build.properties
@@ -18,12 +18,5 @@ bin.includes = .,\
jars.compile.order = .
source.. = src/
output.. = bin/
-src.includes = src/,\
- plugin.xml,\
- plugin.properties,\
- icons/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
+src.includes = icons/,\
about.html
diff --git a/plugins/core/org.eclipse.papyrus.di.edit/plugin.properties b/plugins/core/org.eclipse.papyrus.di.edit/plugin.properties
index b5f2b66e02e..fbf88a31a5f 100644
--- a/plugins/core/org.eclipse.papyrus.di.edit/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.di.edit/plugin.properties
@@ -21,8 +21,8 @@
# %%% END OF TRANSLATED PROPERTIES %%%
# ====================================================================
-pluginName = DI Edit Support (Incubation)
-providerName = Eclipse.org
+pluginName=Papyrus DI Edit Support (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.di.editor/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.di.editor/META-INF/MANIFEST.MF
index f4aa274848b..6d9efc79211 100644
--- a/plugins/core/org.eclipse.papyrus.di.editor/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.di.editor/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.di.editor;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.papyrus.di.presentation.DiEditorPlugin$Implementation
Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.di.editor/build.properties b/plugins/core/org.eclipse.papyrus.di.editor/build.properties
index b54f31bdc1b..c216dcfb67c 100644
--- a/plugins/core/org.eclipse.papyrus.di.editor/build.properties
+++ b/plugins/core/org.eclipse.papyrus.di.editor/build.properties
@@ -18,12 +18,5 @@ bin.includes = .,\
jars.compile.order = .
source.. = src/
output.. = bin/
-src.includes = src/,\
- plugin.xml,\
- plugin.properties,\
- icons/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
+src.includes = icons/,\
about.html
diff --git a/plugins/core/org.eclipse.papyrus.di.editor/plugin.properties b/plugins/core/org.eclipse.papyrus.di.editor/plugin.properties
index d689bc96a91..0d1266d962a 100644
--- a/plugins/core/org.eclipse.papyrus.di.editor/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.di.editor/plugin.properties
@@ -21,8 +21,8 @@
# %%% END OF TRANSLATED PROPERTIES %%%
# ====================================================================
-pluginName = DI Editor (Incubation)
-providerName = Eclipse.org
+pluginName=Papyrus DI Editor (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.di/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.di/META-INF/MANIFEST.MF
index 36967ec94c9..387ebb4e5ba 100644
--- a/plugins/core/org.eclipse.papyrus.di/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.di/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.di;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/core/org.eclipse.papyrus.di/plugin.properties b/plugins/core/org.eclipse.papyrus.di/plugin.properties
index fbc42265c8d..9206fa2fde0 100644
--- a/plugins/core/org.eclipse.papyrus.di/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.di/plugin.properties
@@ -21,6 +21,6 @@
# %%% END OF TRANSLATED PROPERTIES %%%
# ====================================================================
-pluginName = DI Model (Incubation)
-providerName = Eclipse.org
+pluginName=Papyrus DI Model (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
index 92227550f79..62c6d984baf 100644
--- a/plugins/core/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.editor;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.editor.Activator
Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.7.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/core/org.eclipse.papyrus.editor/plugin.properties b/plugins/core/org.eclipse.papyrus.editor/plugin.properties
index a0a94d616b1..5affc17e71e 100644
--- a/plugins/core/org.eclipse.papyrus.editor/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.editor/plugin.properties
@@ -9,4 +9,4 @@
# Cédric Dumoulin - initial API and implementation
##################################################################################
pluginName=Papyrus Core Editor Plugin (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.editor/plugin.xml b/plugins/core/org.eclipse.papyrus.editor/plugin.xml
index ed78a66bbcb..439a0f9d84b 100644
--- a/plugins/core/org.eclipse.papyrus.editor/plugin.xml
+++ b/plugins/core/org.eclipse.papyrus.editor/plugin.xml
@@ -9,6 +9,7 @@
extensions="di"
icon="icons/papyrus/Papyrus_16x16.gif"
id="org.eclipse.papyrus.core.papyrusEditor"
+ matchingStrategy="org.eclipse.papyrus.editor.PapyrusMatchingStrategy"
name="Papyrus Editor Core">
</editor>
</extension>
diff --git a/plugins/core/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java b/plugins/core/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java
new file mode 100644
index 00000000000..d56f212bcfa
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+ package org.eclipse.papyrus.editor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+
+
+public class PapyrusMatchingStrategy implements IEditorMatchingStrategy {
+
+ /**
+ * Check whether an existing editor matches a new editor input, i.e. if the existing editor should
+ * get focus instead of opening a second one. Whereas the passed editor reference always refers to a Papyrus
+ * editor, the passed editor input may not be related to UML, it might for instance be a Java or text
+ * file. Therefore, the code verifies that the new editor input is either a notation, uml or di file
+ *
+ * @see org.eclipse.ui.IEditorMatchingStrategy#matches(org.eclipse.ui.IEditorReference, org.eclipse.ui.IEditorInput)
+ *
+ * @param editorRef
+ * a reference to an opened Papyrus editor
+ * @param newEInput
+ * the new editor input
+ * @return true, if the new input matches the existing editor reference.
+ */
+ public boolean matches(IEditorReference editorRef, IEditorInput newEInput) {
+ if(newEInput instanceof IFileEditorInput) {
+ IFile newFile = ((IFileEditorInput)newEInput).getFile();
+ String extension = newFile.getFileExtension();
+ if("uml".equals(extension) || "di".equals(extension) || "notation".equals(extension)) {
+ try {
+ IEditorInput exiEInput = editorRef.getEditorInput();
+ if((exiEInput instanceof IFileEditorInput)) {
+ IFile exiFile = ((IFileEditorInput)exiEInput).getFile();
+ IPath exiFilenameWOE = exiFile.getFullPath().removeFileExtension();
+ IPath newFilenameWOE = newFile.getFullPath().removeFileExtension();
+
+ if(exiFilenameWOE.equals(newFilenameWOE)) {
+ return true;
+ }
+ }
+ } catch (PartInitException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/.checkstyle b/plugins/core/org.eclipse.papyrus.editors/.checkstyle
new file mode 100644
index 00000000000..75246d341f9
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/.checkstyle
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <fileset name="all" enabled="true" check-config-name="Sun Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/.classpath b/plugins/core/org.eclipse.papyrus.editors/.classpath
index 2d1a4302f04..2d1a4302f04 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/.classpath
+++ b/plugins/core/org.eclipse.papyrus.editors/.classpath
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/.project b/plugins/core/org.eclipse.papyrus.editors/.project
index 91dd4c8a10d..fa988031935 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/.project
+++ b/plugins/core/org.eclipse.papyrus.editors/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.papyrus.service.creation</name>
+ <name>org.eclipse.papyrus.editors</name>
<comment></comment>
<projects>
</projects>
diff --git a/plugins/core/org.eclipse.papyrus.editors/.settings/org.eclipse.core.resources.prefs b/plugins/core/org.eclipse.papyrus.editors/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..f3196edf2ab
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Tue Nov 30 13:14:48 CET 2010
+eclipse.preferences.version=1
+encoding//src/org/eclipse/papyrus/editors/messages/messages.properties=ISO-8859-1
diff --git a/plugins/core/org.eclipse.papyrus.editors/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.editors/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..f3845a03af4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.editors
+Bundle-Version: 0.7.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.editors.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.databinding.property;bundle-version="1.3.0",
+ org.eclipse.emf.common;bundle-version="2.6.0",
+ org.eclipse.core.databinding,
+ org.eclipse.jface.databinding,
+ org.eclipse.papyrus.log;bundle-version="0.7.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.editors,
+ org.eclipse.papyrus.editors.providers,
+ org.eclipse.papyrus.editors.selectors
+Bundle-Localization: plugin
diff --git a/plugins/core/org.eclipse.papyrus.editors/about.html b/plugins/core/org.eclipse.papyrus.editors/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.editors/build.properties b/plugins/core/org.eclipse.papyrus.editors/build.properties
new file mode 100644
index 00000000000..58f7e08f233
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ icons/,\
+ plugin.properties,\
+ about.html
+src.includes = icons/,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/Add_12x12.gif b/plugins/core/org.eclipse.papyrus.editors/icons/Add_12x12.gif
new file mode 100644
index 00000000000..189b46e5a5b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/Add_12x12.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/Delete_12x12.gif b/plugins/core/org.eclipse.papyrus.editors/icons/Delete_12x12.gif
new file mode 100644
index 00000000000..bd924a5e0fa
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/Delete_12x12.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/Down_12x12.gif b/plugins/core/org.eclipse.papyrus.editors/icons/Down_12x12.gif
new file mode 100644
index 00000000000..c0672e72a2b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/Down_12x12.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/PapyrusLogo16x16.gif b/plugins/core/org.eclipse.papyrus.editors/icons/PapyrusLogo16x16.gif
new file mode 100644
index 00000000000..8a31f458379
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/PapyrusLogo16x16.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/Up_12x12.gif b/plugins/core/org.eclipse.papyrus.editors/icons/Up_12x12.gif
new file mode 100644
index 00000000000..9620d683cbd
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/Up_12x12.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/arrow_double.gif b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_double.gif
new file mode 100644
index 00000000000..c02db2c9df4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_double.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left.gif b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left.gif
new file mode 100644
index 00000000000..4fb41501036
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left_double.gif b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left_double.gif
new file mode 100644
index 00000000000..336b55cf08e
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_left_double.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/icons/arrow_right.gif b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_right.gif
new file mode 100644
index 00000000000..19567890aa8
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/icons/arrow_right.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.editors/plugin.properties b/plugins/core/org.eclipse.papyrus.editors/plugin.properties
new file mode 100644
index 00000000000..c7e121feb0b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - initial API and implementation
+##################################################################################
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Editors (Incubation) \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractEditor.java
new file mode 100644
index 00000000000..3927573939f
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractEditor.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.conversion.IConverter;
+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.Label;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * An Abstract class to represent Editors.
+ * An editor is a Composite, containing a label and one
+ * or more controls. The label may be null.
+ * The controls are specified by the implementations
+ * of this abstract class.
+ *
+ * @author Camille Letavernier
+ */
+public abstract class AbstractEditor extends Composite {
+
+ /**
+ * The label for this editor. May be null.
+ */
+ protected Label label;
+
+ /**
+ * The factory for creating all the editors with a common style
+ */
+ public static TabbedPropertySheetWidgetFactory factory = new TabbedPropertySheetWidgetFactory();
+
+ /**
+ *
+ * Constructor. Constructs an editor without a label
+ *
+ * @param parent
+ * The composite in which this editor should be created
+ */
+ public AbstractEditor(Composite parent) {
+ this(parent, SWT.NONE, null);
+ }
+
+ /**
+ *
+ * Constructor. Constructs an editor without a label
+ *
+ * @param parent
+ * The composite in which this editor should be created
+ * @param style
+ * The style of this editor's main composite
+ */
+ public AbstractEditor(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ *
+ * Constructor. Constructs an editor with a label
+ *
+ * @param parent
+ * The composite in which this editor should be created
+ * @param label
+ * The label that will be displayed for this editor, or null
+ * if no label should be displayed
+ */
+ public AbstractEditor(Composite parent, String label) {
+ this(parent, SWT.NONE, label);
+ }
+
+ /**
+ *
+ * Constructor. Constructs an editor with a label
+ *
+ * @param parent
+ * The composite in which this editor should be created
+ * @param style
+ * The style of this editor's main composite
+ * @param label
+ * The label that will be displayed for this editor, or null
+ * if no label should be displayed
+ */
+ public AbstractEditor(Composite parent, int style, String label) {
+ super(parent, style);
+ setLayout(new GridLayout(2, false));
+ if(label != null) {
+ createLabel(label);
+ }
+ }
+
+ /**
+ * Creates the label widget with the given text
+ *
+ * @param text
+ * The text to be displayed on the label
+ */
+ protected void createLabel(String text) {
+ label = factory.createLabel(this, text);
+ label.setLayoutData(getLabelLayoutData());
+ }
+
+ /**
+ * @return The default layoutData for the label
+ */
+ protected GridData getLabelLayoutData() {
+ GridData data = new GridData();
+ data.widthHint = 120;
+ data.verticalAlignment = SWT.CENTER;
+
+ return data;
+ }
+
+ /**
+ * This method should be called by subclasses to get the default layoutData
+ * for a control in this editor.
+ *
+ * @return The default layoutData for the main control
+ */
+ protected GridData getDefaultLayoutData() {
+ GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ return data;
+ }
+
+ /**
+ * Changes the text label for this editor. This method is available
+ * only when the editor has been constructed with a label.
+ *
+ * @param label
+ * The new text for this editor's label
+ */
+ public void setLabel(String label) {
+ if(this.label != null) {
+ this.label.setText(label);
+ }
+ //TODO : else createLabel (Before the control(s))
+ }
+
+ /**
+ * Sets the converters to convert data from Model to Target (Widget),
+ * and from Widget to Model
+ *
+ * @param targetToModel
+ * @param modelToTarget
+ */
+ abstract public void setConverters(IConverter targetToModel, IConverter modelToTarget);
+
+ /**
+ * Gets the BindingContext associated to the editors
+ *
+ * @return
+ */
+ protected DataBindingContext getBindingContext() {
+ return new DataBindingContext();
+ }
+
+ /**
+ * Binds the Widget Observable to the Model observable property,
+ * using the specified converters when available
+ */
+ abstract protected void doBinding();
+
+ /**
+ * @return the type of objects that this widget can edit
+ */
+ public abstract Object getEditableType();
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractListEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractListEditor.java
new file mode 100644
index 00000000000..aaa42609018
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractListEditor.java
@@ -0,0 +1,154 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.UpdateListStrategy;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An abstract class to represent List Editors.
+ * List editors are based on the Eclipse Databinding Framework
+ * They take IObservableLists as Input
+ *
+ * @author Camille Letavernier
+ *
+ */
+public abstract class AbstractListEditor extends AbstractEditor {
+
+ /**
+ * The IObservableList associated to the model property
+ */
+ protected IObservableList modelProperty;
+
+ /**
+ * The UpdateStrategy for binding data from widget to model
+ */
+ protected UpdateListStrategy targetToModelStrategy;
+
+ /**
+ * The UpdateStrategy for binding data from model to widget
+ */
+ protected UpdateListStrategy modelToTargetStrategy;
+
+ /**
+ * The IObservableList associated to the widget
+ */
+ protected IObservableList widgetObservable;
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractListEditor(Composite parent) {
+ super(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractListEditor(Composite parent, int style, String label) {
+ super(parent, style, label);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractListEditor(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractListEditor(Composite parent, String label) {
+ super(parent, label);
+ }
+
+ /**
+ * Sets this editor's IObservableList associated to the widget property
+ *
+ * @param widgetObservable
+ * @param targetToModel
+ * the IConverter to convert data from Widget to Model
+ * @param modelToTarget
+ * the IConverter to convert data from Model to Widget
+ */
+ protected void setWidgetObservable(IObservableList widgetObservable, IConverter targetToModel, IConverter modelToTarget) {
+ this.widgetObservable = widgetObservable;
+ setConverters(targetToModel, modelToTarget);
+ }
+
+ /**
+ * Sets this editor's IObservableList associated to the widget property
+ *
+ * @param widgetObservable
+ */
+ protected void setWidgetObservable(IObservableList widgetObservable) {
+ this.widgetObservable = widgetObservable;
+ }
+
+ /**
+ * Sets this editor's IObservableList associated to the model property,
+ * and binds it to the Editor's Widget
+ *
+ * @param modelProperty
+ */
+ public void setModelObservable(IObservableList modelProperty) {
+ this.modelProperty = modelProperty;
+ doBinding();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setConverters(IConverter targetToModel, IConverter modelToTarget) {
+ if(targetToModelStrategy == null) {
+ targetToModelStrategy = new UpdateListStrategy();
+ }
+ if(modelToTargetStrategy == null) {
+ modelToTargetStrategy = new UpdateListStrategy();
+ }
+
+ targetToModelStrategy.setConverter(targetToModel);
+ modelToTargetStrategy.setConverter(modelToTarget);
+ }
+
+ /**
+ * Sets the UpdateStrategies for databinding between the widget and the model
+ *
+ * @param targetToModelStrategy
+ * The widget to model Update strategy
+ * @param modelToTargetStrategy
+ * The model to widget Update strategy
+ */
+ public void setUpdateStrategies(UpdateListStrategy targetToModelStrategy, UpdateListStrategy modelToTargetStrategy) {
+ this.targetToModelStrategy = targetToModelStrategy;
+ this.modelToTargetStrategy = modelToTargetStrategy;
+ }
+
+ /**
+ * Binds the Widget Observable to the Model observable property,
+ * using the specified converters or Update strategies when available
+ *
+ * @see org.eclipse.papyrus.editors.AbstractEditor#doBinding()
+ */
+ @Override
+ protected void doBinding() {
+
+ if(modelProperty == null || widgetObservable == null)
+ return;
+
+ getBindingContext().bindList(widgetObservable, modelProperty, targetToModelStrategy, modelToTargetStrategy);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractValueEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractValueEditor.java
new file mode 100644
index 00000000000..79b04fbc900
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/AbstractValueEditor.java
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.swt.widgets.Composite;
+
+
+public abstract class AbstractValueEditor extends AbstractEditor {
+
+ /**
+ * The IObservableValue associated to the model property
+ */
+ protected IObservableValue modelProperty;
+
+ /**
+ * The IObservableValue associated to the widget
+ */
+ protected IObservableValue widgetObservable;
+
+ /**
+ * The UpdateStrategy for binding data from widget to model
+ */
+ protected UpdateValueStrategy targetToModelStrategy;
+
+ /**
+ * The UpdateStrategy for binding data from model to widget
+ */
+ protected UpdateValueStrategy modelToTargetStrategy;
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractValueEditor(Composite parent) {
+ super(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractValueEditor(Composite parent, int style, String label) {
+ super(parent, style, label);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractValueEditor(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractValueEditor(Composite parent, String label) {
+ super(parent, label);
+ }
+
+ /**
+ * Sets this editor's IObservableValue associated to the widget property
+ *
+ * @param widgetObservable
+ * @param targetToModel
+ * the IConverter to convert data from Widget to Model
+ * @param modelToTarget
+ * the IConverter to convert data from Model to Widget
+ */
+ protected void setWidgetObservable(IObservableValue widgetObservable, IConverter targetToModel, IConverter modelToTarget) {
+ this.widgetObservable = widgetObservable;
+ setConverters(targetToModel, modelToTarget);
+ }
+
+ /**
+ * Sets this editor's IObservableValue associated to the widget property
+ *
+ * @param widgetObservable
+ */
+ protected void setWidgetObservable(IObservableValue widgetObservable) {
+ this.widgetObservable = widgetObservable;
+ }
+
+ /**
+ * Sets this editor's IObservableValue associated to the model property,
+ * and binds it to the Editor's Widget
+ *
+ * @param modelProperty
+ */
+ public void setModelObservable(IObservableValue modelProperty) {
+ this.modelProperty = modelProperty;
+ doBinding();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setConverters(IConverter targetToModel, IConverter modelToTarget) {
+ if(targetToModelStrategy == null) {
+ targetToModelStrategy = new UpdateValueStrategy();
+ }
+ if(modelToTargetStrategy == null) {
+ modelToTargetStrategy = new UpdateValueStrategy();
+ }
+
+ targetToModelStrategy.setConverter(targetToModel);
+ modelToTargetStrategy.setConverter(modelToTarget);
+ }
+
+ /**
+ * Sets the UpdateStrategies for databinding between the widget and the model
+ *
+ * @param targetToModelStrategy
+ * The widget to model Update strategy
+ * @param modelToTargetStrategy
+ * The model to widget Update strategy
+ */
+ public void setUpdateStrategies(UpdateValueStrategy targetToModelStrategy, UpdateValueStrategy modelToTargetStrategy) {
+ this.targetToModelStrategy = targetToModelStrategy;
+ this.modelToTargetStrategy = modelToTargetStrategy;
+ }
+
+ /**
+ * Binds the Widget Observable to the Model observable property,
+ * using the specified converters or Update strategies when available
+ *
+ * @see org.eclipse.papyrus.editors.AbstractEditor#doBinding()
+ */
+ @Override
+ protected void doBinding() {
+
+ if(modelProperty == null || widgetObservable == null)
+ return;
+
+ getBindingContext().bindValue(widgetObservable, modelProperty, targetToModelStrategy, modelToTargetStrategy);
+ }
+
+ /**
+ * Returns the value from the widget
+ * May be used even when the Model Observable is not set
+ */
+ public abstract Object getValue();
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/Activator.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/Activator.java
new file mode 100644
index 00000000000..0354e8c736d
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/Activator.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.papyrus.log.LogHelper;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.editors"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(plugin);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the image from the given image descriptor
+ *
+ * @param path
+ * the path of the image to be displayed
+ * @return the image found
+ */
+ public static Image getImage(String path) {
+ final ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(path);
+ if(image == null) {
+ registry.put(path, Activator.imageDescriptorFromPlugin(PLUGIN_ID, path));
+ image = registry.get(path);
+ }
+ return image;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanCheckbox.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanCheckbox.java
new file mode 100644
index 00000000000..c7875d68399
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanCheckbox.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A Property Editor representing a Boolean value
+ * as a Checkbox.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class BooleanCheckbox extends AbstractValueEditor {
+
+ private Button checkbox;
+
+ /**
+ *
+ * Constructor. Creates a new Property Editor for a Boolean
+ * value, represented as a Checkbox.
+ *
+ * @param parent
+ * This editor's parent composite
+ * @param style
+ * The style applied to this editor's checkbox
+ */
+ public BooleanCheckbox(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ *
+ * Constructor. Creates a new Property Editor for a Boolean
+ * value, represented as a Checkbox, with the given label
+ *
+ * @param parent
+ * This editor's parent composite
+ * @param style
+ * The style applied to this editor's checkbox
+ * @param label
+ * The label for this editor
+ */
+ public BooleanCheckbox(Composite parent, int style, String label) {
+ super(parent);
+ checkbox = factory.createButton(this, label, SWT.CHECK | style);
+ //checkbox = new Button(this, SWT.CHECK | style);
+
+ setWidgetObservable(WidgetProperties.selection().observe(checkbox));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Boolean getValue() {
+ return checkbox.getSelection();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanRadio.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanRadio.java
new file mode 100644
index 00000000000..e3c0826eade
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/BooleanRadio.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.SelectObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A Property Editor representing a Boolean value
+ * as a Radio, with two options (true/false).
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class BooleanRadio extends AbstractValueEditor {
+
+ /**
+ * The "true" radio button
+ */
+ protected Button trueRadio;
+
+ /**
+ * The "false" radio button
+ */
+ protected Button falseRadio;
+
+ /**
+ *
+ * Constructor. Creates a new Property Editor for a Boolean
+ * value, represented by two radio buttons.
+ *
+ * @param parent
+ * This editor's parent composite
+ * @param style
+ * The style applied to this editor's radio buttons
+ */
+ public BooleanRadio(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ public BooleanRadio(Composite parent, int style, String label) {
+ super(parent, label);
+
+ setLayout(new GridLayout(3, false));
+
+ //trueRadio = new Button(this, SWT.RADIO);
+ //trueRadio.setText("true");
+ trueRadio = factory.createButton(this, "true", style | SWT.RADIO); //$NON-NLS-1$
+
+ // falseRadio = new Button(this, SWT.RADIO);
+ // falseRadio.setText("false");
+ falseRadio = factory.createButton(this, "false", style | SWT.RADIO); //$NON-NLS-1$
+
+ setWidgetObservable(getObservable());
+ }
+
+ /**
+ * Defines a single observable value, encapsulating the ones
+ * from each radio button (true / false)
+ *
+ * @return The encapsulating observable value
+ */
+ private IObservableValue getObservable() {
+ IObservableValue trueObservable = WidgetProperties.selection().observe(trueRadio);
+ IObservableValue falseObservable = WidgetProperties.selection().observe(falseRadio);
+
+ SelectObservableValue observable = new SelectObservableValue();
+ observable.addOption(true, trueObservable);
+ observable.addOption(false, falseObservable);
+
+ return observable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Boolean getValue() {
+ return trueRadio.getSelection();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleReferenceEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleReferenceEditor.java
new file mode 100644
index 00000000000..fa62a1978d6
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleReferenceEditor.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.editors.providers.IStaticContentProvider;
+import org.eclipse.papyrus.editors.selectors.ReferenceSelector;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A Property Editor representing a MultipleReference
+ * as a label with the selected values. If the list
+ * of values is too long, it gets truncated.
+ * The values can be edited via a selection dialog.
+ * This widget is useful when there is not much vertical space available,
+ * and a MultipleReferenceEditor can not be used.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class CompactMultipleReferenceEditor extends CompactMultipleValueEditor {
+
+ /**
+ * The selector for the available values
+ */
+ protected ReferenceSelector selector;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param style
+ * @param ordered
+ * @param unique
+ */
+ public CompactMultipleReferenceEditor(Composite parent, int style, boolean ordered, boolean unique) {
+ super(parent, style, new ReferenceSelector(unique), ordered, unique);
+ this.selector = (ReferenceSelector)super.selector;
+ }
+
+ /**
+ * Sets the Content and Label providers for this widget.
+ *
+ * The label provider is used in each place where the values can
+ * be displayed
+ * The content provider is used to display the items that can be selected
+ *
+ * @param contentProvider
+ * The content provider for this widget
+ * @param labelProvider
+ * The label provider for this widget
+ */
+ public void setProviders(IStaticContentProvider contentProvider, ILabelProvider labelProvider) {
+ selector.setContentProvider(contentProvider);
+ selector.setLabelProvider(labelProvider);
+ super.setLabelProvider(labelProvider);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleValueEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleValueEditor.java
new file mode 100644
index 00000000000..de6f1f1f67d
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/CompactMultipleValueEditor.java
@@ -0,0 +1,233 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+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.Label;
+
+/**
+ * A Property Editor representing a multivalued property as a label with the
+ * selected values. If the list of values is too long, it gets truncated.
+ * The values can be edited via a selection dialog.
+ * This widget is useful when there is not much vertical space available,
+ * and a MultipleValueEditor can not be used.
+ */
+public class CompactMultipleValueEditor extends AbstractListEditor implements IChangeListener, DisposeListener, SelectionListener {
+
+ /**
+ * The label for displayed the selected values
+ */
+ protected Label valueLabel;
+
+ /**
+ * The button to open a dialog for editing the values
+ */
+ protected Button edit;
+
+ /**
+ * The label provider for this editor. Also used by the
+ * dialog.
+ */
+ protected ILabelProvider labelProvider;
+
+ /**
+ * The string used for separating values in the value label
+ */
+ protected String separator;
+
+ /**
+ * The Dialog displayed when adding new elements
+ */
+ protected MultipleValueSelectorDialog dialog;
+
+ /**
+ * The element selector for the dialog
+ */
+ protected IElementSelector selector;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The widget in which this editor is created
+ * @param style
+ * The style for this editor's control
+ * @param selector
+ * The element selector to be used in the selection dialog
+ * @param ordered
+ * True if the multivalued property is ordered
+ * @param unique
+ * True if the multivalued property needs unique values
+ */
+ public CompactMultipleValueEditor(Composite parent, int style, IElementSelector selector, boolean ordered, boolean unique) {
+ this(parent, style, selector, ordered, unique, ", ", null); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The widget in which this editor is created
+ * @param style
+ * The style for this editor's control
+ * @param selector
+ * The element selector to be used in the selection dialog
+ * @param ordered
+ * True if the multivalued property is ordered
+ * @param unique
+ * True if the multivalued property needs unique values
+ * @param separator
+ * The string used to separate values in the display label
+ * @param label
+ * The label for this editor
+ */
+ public CompactMultipleValueEditor(Composite parent, int style, IElementSelector selector, boolean ordered, boolean unique, String separator, String label) {
+ super(parent, label);
+
+ setLayout(new GridLayout(3, false));
+
+ valueLabel = factory.createLabel(this, null, style);
+ valueLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ edit = new Button(this, SWT.PUSH);
+ edit.setText("..."); //$NON-NLS-1$
+ edit.addSelectionListener(this);
+ edit.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+
+ this.selector = selector;
+ dialog = new MultipleValueSelectorDialog(parent.getShell(), selector, unique);
+
+ labelProvider = new LabelProvider();
+ this.separator = separator;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Collection.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doBinding() {
+ //We don't do a real Databinding in this case
+ modelProperty.addChangeListener(this);
+ getParent().addDisposeListener(this);
+ handleChange(null);
+ }
+
+ /**
+ * Sets the label provider for this editor
+ *
+ * @param provider
+ * The label provider for this editor
+ */
+ public void setLabelProvider(ILabelProvider provider) {
+ dialog.setLabelProvider(provider);
+ this.labelProvider = provider;
+ }
+
+ /**
+ * Refreshes the Label when a change occurs on the ObservableList
+ *
+ * @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
+ *
+ * @param event
+ */
+ public void handleChange(ChangeEvent event) {
+ List<String> labels = new LinkedList<String>();
+ for(Object element : modelProperty) {
+ labels.add(labelProvider.getText(element));
+ }
+ valueLabel.setText(createValueLabel(labels));
+ }
+
+ /**
+ * Creates the text for the value label of this editor
+ *
+ * @param labels
+ * The labels for each selected element
+ * @return
+ * The concatenated label
+ */
+ protected String createValueLabel(List<String> labels) {
+ if(labels.size() == 0)
+ return ""; //$NON-NLS-1$
+
+ String result = labels.get(0);
+ for(int i = 1; i < labels.size(); i++) {
+ result += separator + labels.get(i);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
+ dispose();
+ modelProperty.removeChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc} Handles the event when the edit button is pressed
+ */
+ public void widgetSelected(SelectionEvent e) {
+ dialog.setInitialSelections(modelProperty.toArray());
+ int returnCode = dialog.open();
+ if(returnCode == Window.CANCEL)
+ return;
+
+ modelProperty.clear();
+
+ Object[] result = dialog.getResult();
+ if(result == null) {
+ return;
+ }
+
+ java.util.List<Object> resultElements = new LinkedList<Object>();
+ for(Object r : result) {
+ resultElements.add(r);
+ }
+
+ modelProperty.addAll(resultElements);
+ }
+
+ /**
+ * {@inheritDoc} Ignored
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/EnumCombo.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/EnumCombo.java
new file mode 100644
index 00000000000..835702debdf
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/EnumCombo.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An editor representing an Enumeration as a Combo
+ * This Editor needs a ContentProvider describing the Enumerated values,
+ * and an optional label provider
+ *
+ * @author Camille Letavernier
+ */
+public class EnumCombo extends ReferenceCombo {
+
+ /**
+ * {@inheritDoc}
+ */
+ public EnumCombo(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EnumCombo(Composite parent, int style, String label) {
+ super(parent, style, label);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/FloatEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/FloatEditor.java
new file mode 100644
index 00000000000..320141d80e6
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/FloatEditor.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.conversion.NumberToStringConverter;
+import org.eclipse.core.databinding.conversion.StringToNumberConverter;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An editor representing a float value as a text box
+ *
+ * @author Camille Letavernier
+ */
+public class FloatEditor extends StringEditor {
+
+ private IConverter targetToModelConverter;
+
+ /**
+ * {@inheritDoc}
+ */
+ public FloatEditor(Composite parent, int style) {
+ super(parent, style);
+
+ targetToModelConverter = StringToNumberConverter.toFloat(true);
+ setConverters(targetToModelConverter, NumberToStringConverter.fromFloat(true));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Float.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Float getValue() {
+ try {
+ return (Float)targetToModelConverter.convert(super.getValue());
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ return null;
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IElementSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IElementSelector.java
new file mode 100644
index 00000000000..d0f7ca6d516
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IElementSelector.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An interface for defining widgets that can return
+ * some values.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public interface IElementSelector {
+
+ /**
+ *
+ * @return The currently selected elements
+ */
+ public Object[] getSelectedElements();
+
+ /**
+ * Sets the elements that have already been chosen.
+ *
+ * @param elements
+ */
+ public void setSelectedElements(Object[] elements);
+
+ /**
+ *
+ * @return all displayed elements. If the widget uses a filter,
+ * only the filtered elements should be returned
+ */
+ public Object[] getAllElements();
+
+ /**
+ * Creates the widgets to display this selector
+ *
+ * @param parent
+ */
+ public void createControls(Composite parent);
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IntegerEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IntegerEditor.java
new file mode 100644
index 00000000000..06813cc5edd
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/IntegerEditor.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.conversion.NumberToStringConverter;
+import org.eclipse.core.databinding.conversion.StringToNumberConverter;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A Property Editor representing an Integer value
+ * as a text box.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class IntegerEditor extends StringEditor {
+
+ /**
+ * The IConverter for converting data from the widget to the model
+ */
+ private IConverter targetToModelConverter;
+
+ /**
+ * {@inheritDoc}
+ */
+ public IntegerEditor(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IntegerEditor(Composite parent, int style, String label) {
+ super(parent, style, label);
+
+ targetToModelConverter = StringToNumberConverter.toInteger(true);
+
+ setConverters(targetToModelConverter, NumberToStringConverter.fromInteger(true));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Integer.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Integer getValue() {
+ try {
+ return (Integer)targetToModelConverter.convert(super.getValue());
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ return null;
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleIntegerEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleIntegerEditor.java
new file mode 100644
index 00000000000..1e481d263df
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleIntegerEditor.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.papyrus.editors.selectors.IntegerSelector;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An editor for multivalued Integer attributes
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MultipleIntegerEditor extends MultipleStringEditor {
+
+ /**
+ * {@inheritDoc}
+ */
+ public MultipleIntegerEditor(Composite parent, int style, boolean ordered, boolean unique, String label) {
+ super(parent, style, new IntegerSelector(), ordered, unique, label);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleReferenceEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleReferenceEditor.java
new file mode 100644
index 00000000000..42aa131a0d2
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleReferenceEditor.java
@@ -0,0 +1,101 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.editors.providers.IStaticContentProvider;
+import org.eclipse.papyrus.editors.selectors.ReferenceSelector;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An editor for multivalued references. This editor should be used when
+ * there is enough vertical space available. If the vertical space is limited,
+ * CompactMultipleReferenceEditor should be used instead.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MultipleReferenceEditor extends MultipleValueEditor {
+
+ /**
+ * The element selector for the available values
+ */
+ protected ReferenceSelector selector;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor is created
+ * @param style
+ * The style for this editor's list
+ * @param ordered
+ * True if the list should be ordered
+ * @param unique
+ * True if the list values should be unique
+ * @param label
+ * The label for this editor
+ */
+ public MultipleReferenceEditor(Composite parent, int style, boolean ordered, boolean unique, String label) {
+ super(parent, style, new ReferenceSelector(unique), ordered, unique, label);
+ this.selector = (ReferenceSelector)super.selector;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor is created
+ * @param style
+ * The style for this editor's list
+ * @param label
+ * The label for this editor
+ */
+ public MultipleReferenceEditor(Composite parent, int style, String label) {
+ this(parent, style, false, false, label);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor is created
+ * @param style
+ * The style for this editor's list
+ */
+ public MultipleReferenceEditor(Composite parent, int style) {
+ this(parent, style, false, false, null);
+ }
+
+ /**
+ * Sets the Content and Label providers for this editor
+ *
+ * @param contentProvider
+ * The content provider describing the elements that can be selected
+ * @param labelProvider
+ * The label provider for the elements
+ */
+ public void setProviders(IStaticContentProvider contentProvider, ILabelProvider labelProvider) {
+ Assert.isNotNull(contentProvider, "The content provider should be defined"); //$NON-NLS-1$
+
+ selector.setContentProvider(contentProvider);
+
+ if(labelProvider != null) {
+ selector.setLabelProvider(labelProvider);
+ super.setLabelProvider(labelProvider);
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleStringEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleStringEditor.java
new file mode 100644
index 00000000000..469e6c47313
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleStringEditor.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.papyrus.editors.selectors.StringSelector;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * An editor for multivalued String attributes
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MultipleStringEditor extends MultipleValueEditor {
+
+ /**
+ * {@inheritDoc}
+ */
+ public MultipleStringEditor(Composite parent, int style, boolean ordered, boolean unique) {
+ super(parent, style, new StringSelector(), ordered, unique, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public MultipleStringEditor(Composite parent, int style, boolean ordered, boolean unique, String label) {
+ super(parent, style, new StringSelector(), ordered, unique, label);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public MultipleStringEditor(Composite parent, int style, IElementSelector selector, boolean ordered, boolean unique, String label) {
+ super(parent, style, selector, ordered, unique, label);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueEditor.java
new file mode 100644
index 00000000000..e493758e562
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueEditor.java
@@ -0,0 +1,366 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.editors.messages.Messages;
+import org.eclipse.papyrus.editors.providers.CollectionContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+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.List;
+
+/**
+ * An editor for multivalued fields.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MultipleValueEditor extends AbstractListEditor implements SelectionListener, IChangeListener, DisposeListener {
+
+ /**
+ * The viewer displaying the current values from
+ * the model
+ */
+ protected ListViewer listViewer;
+
+ /**
+ * The list associated to the viewer
+ */
+ protected List list;
+
+ /**
+ * A Composite containing the different control buttons
+ * (Add, remove, ...)
+ */
+ protected Composite controlsSection;
+
+ /**
+ * The Add control
+ */
+ protected Button add;
+
+ /**
+ * The Remove control
+ */
+ protected Button remove;
+
+ /**
+ * The Up control
+ */
+ protected Button up;
+
+ /**
+ * The Down control
+ */
+ protected Button down;
+
+ /**
+ * The Dialog displayed when adding new elements
+ */
+ protected MultipleValueSelectorDialog dialog;
+
+ /**
+ * The element selector for this editor's dialog
+ */
+ protected IElementSelector selector;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The Composite in which this Editor should be displayed
+ * @param style
+ * This editor's list style
+ * @param selector
+ * The element selector for this editor's dialog
+ * @param label
+ * This editor's label, or null if no label should be displayed
+ * @param ordered
+ * Specify if the observed collection is ordered. If true, Up and Down controls are displayed.
+ * @param unique
+ * Specify if the observed collection values are unique.
+ * @param label
+ * The label for this editor. If null, the label isn't created.
+ */
+ public MultipleValueEditor(Composite parent, int style, IElementSelector selector, boolean ordered, boolean unique, String label) {
+ super(parent, label);
+ Assert.isNotNull(selector, "The Element Selector must be specified for a MultipleValueEditor"); //$NON-NLS-1$
+
+ setLayout(new GridLayout(label == null ? 1 : 2, false));
+
+ controlsSection = new Composite(this, SWT.NONE);
+ controlsSection.setLayout(new FillLayout());
+ controlsSection.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+
+ list = new List(this, style | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ listData.horizontalSpan = 2;
+ listData.minimumHeight = 80;
+ list.setLayoutData(listData);
+
+ listViewer = new ListViewer(list);
+ listViewer.setContentProvider(new CollectionContentProvider());
+
+ createListControls(ordered);
+
+ this.selector = selector;
+ dialog = new MultipleValueSelectorDialog(parent.getShell(), selector, label, unique);
+
+ setLabelProvider(new LabelProvider());
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The Composite in which this Editor should be displayed
+ * @param style
+ * This editor's list style
+ * @param selector
+ * The element selector for this editor's dialog
+ * @param ordered
+ * Specify if the observed collection is ordered. If true, Up and Down controls are displayed
+ */
+ public MultipleValueEditor(Composite parent, int style, IElementSelector selector, boolean ordered) {
+ this(parent, style, selector, ordered, false, null);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The Composite in which this Editor should be displayed
+ * @param style
+ * This editor's list style
+ * @param selector
+ * The element selector for this editor's dialog
+ */
+ public MultipleValueEditor(Composite parent, int style, IElementSelector selector) {
+ this(parent, style, selector, false, false, null);
+ }
+
+ /**
+ * Sets the label provider for this editor
+ *
+ * @param labelProvider
+ * The label provider for this editor
+ */
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ dialog.setLabelProvider(labelProvider);
+ listViewer.setLabelProvider(labelProvider);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doBinding() {
+ //We don't do a real Databinding in this case
+ listViewer.setInput(modelProperty);
+ modelProperty.addChangeListener(this);
+ getParent().addDisposeListener(this);
+ }
+
+ /**
+ * @param ordered
+ */
+ public void setOrdered(boolean ordered) {
+ this.dialog.setOrdered(ordered);
+ }
+
+ /**
+ * @param unique
+ */
+ public void setUnique(boolean unique) {
+ this.dialog.setUnique(unique);
+ }
+
+ /**
+ * Creates the Add/Remove controls,
+ * and the Up/Down controls if the collection is ordered
+ *
+ * @param ordered
+ */
+ private void createListControls(boolean ordered) {
+ if(ordered) {
+ up = new Button(controlsSection, SWT.PUSH);
+ up.setImage(Activator.getImage("/icons/Up_12x12.gif")); //$NON-NLS-1$
+ up.addSelectionListener(this);
+ up.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsUp);
+
+ down = new Button(controlsSection, SWT.PUSH);
+ down.setImage(Activator.getImage("/icons/Down_12x12.gif")); //$NON-NLS-1$
+ down.addSelectionListener(this);
+ down.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsDown);
+ }
+
+ add = new Button(controlsSection, SWT.PUSH);
+ add.setImage(Activator.getImage("/icons/Add_12x12.gif")); //$NON-NLS-1$
+ add.addSelectionListener(this);
+ add.setToolTipText(Messages.MultipleValueEditor_AddElements);
+
+ remove = new Button(controlsSection, SWT.PUSH);
+ remove.setImage(Activator.getImage("/icons/Delete_12x12.gif")); //$NON-NLS-1$
+ remove.addSelectionListener(this);
+ remove.setToolTipText(Messages.MultipleValueEditor_RemoveSelectedElements);
+ }
+
+ @Override
+ public Object getEditableType() {
+ return Collection.class;
+ }
+
+ /**
+ * Handle events occuring on controls
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ *
+ * @param e
+ */
+ public void widgetSelected(SelectionEvent e) {
+ if(e.widget == null)
+ return;
+
+ if(e.widget == add) {
+ addAction();
+ } else if(e.widget == remove) {
+ removeAction();
+ } else if(e.widget == up) {
+ upAction();
+ } else if(e.widget == down) {
+ downAction();
+ }
+ }
+
+ /**
+ * Handle add Action
+ */
+ private void addAction() {
+ if(modelProperty != null)
+ dialog.setInitialSelections(modelProperty.toArray());
+ else
+ dialog.setInitialSelections(new Object[0]);
+
+ int returnCode = dialog.open();
+ if(returnCode == Window.CANCEL)
+ return;
+
+ modelProperty.clear();
+
+ Object[] result = dialog.getResult();
+ if(result == null) {
+ return;
+ }
+
+ java.util.List<Object> resultElements = new LinkedList<Object>();
+ for(Object r : result) {
+ resultElements.add(r);
+ }
+
+ modelProperty.addAll(resultElements);
+ }
+
+ /**
+ * Handle remove Action
+ */
+ private void removeAction() {
+ IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
+ for(Object value : selection.toArray()) {
+ modelProperty.remove(value);
+ }
+ listViewer.setSelection(null);
+ }
+
+ /**
+ * Handle up Action
+ */
+ private void upAction() {
+ IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
+ for(Object o : selection.toArray()) {
+ int oldIndex = modelProperty.indexOf(o);
+ if(oldIndex > 0)
+ modelProperty.move(oldIndex, oldIndex - 1);
+ }
+
+ IStructuredSelection selectionCopy = new StructuredSelection(selection.toArray());
+ listViewer.setSelection(selectionCopy);
+ }
+
+ /**
+ * Handle down Action
+ */
+ private void downAction() {
+ IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
+
+ int maxIndex = modelProperty.size() - 1;
+
+ Object[] selectionArray = selection.toArray();
+ for(int i = selectionArray.length - 1; i >= 0; i--) {
+ Object o = selectionArray[i];
+ int oldIndex = modelProperty.indexOf(o);
+ if(oldIndex < maxIndex)
+ modelProperty.move(oldIndex, oldIndex + 1);
+ }
+
+ IStructuredSelection selectionCopy = new StructuredSelection(selection.toArray());
+ listViewer.setSelection(selectionCopy);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ /**
+ * Gets the list viewer associated to this editor
+ *
+ * @return the list viewer associated to this editor
+ */
+ public ListViewer getViewer() {
+ return listViewer;
+ }
+
+ /**
+ * Refreshes the viewer when a change occurs on the ObservableList
+ *
+ * @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
+ *
+ * @param event
+ */
+ public void handleChange(ChangeEvent event) {
+ listViewer.refresh(true);
+ }
+
+ public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
+ dispose();
+ modelProperty.removeChangeListener(this);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueSelectorDialog.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueSelectorDialog.java
new file mode 100644
index 00000000000..709c8821b98
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/MultipleValueSelectorDialog.java
@@ -0,0 +1,504 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.editors.messages.Messages;
+import org.eclipse.papyrus.editors.providers.CollectionContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+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.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * Object Chooser. Defines a standard popup for selecting
+ * multiple values.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MultipleValueSelectorDialog extends SelectionDialog implements SelectionListener {
+
+ /**
+ * The object selector
+ */
+ protected IElementSelector selector;
+
+ /**
+ * The SWT Composite in which the selector is drawn
+ */
+ protected Composite selectorSection;
+
+ /**
+ * The add/remove/addAll buttons section
+ */
+ protected Composite buttonsSection;
+
+ /**
+ * The up/down buttons section
+ */
+ protected Composite rightButtonsSection;
+
+ /**
+ * The listViewer for chosen elements
+ */
+ protected ListViewer selectedElementsViewer;
+
+ /**
+ * The list for chosen elements
+ */
+ protected List selectedElements;
+
+ /**
+ * The add action button
+ */
+ protected Button add;
+
+ /**
+ * The remove action button
+ */
+ protected Button remove;
+
+ /**
+ * The add all action button
+ */
+ protected Button addAll;
+
+ /**
+ * The remove all action button
+ */
+ protected Button removeAll;
+
+ /**
+ * the up action button
+ */
+ protected Button up;
+
+ /**
+ * the down action button
+ */
+ protected Button down;
+
+ /**
+ * The label provider for the listViewer of chosen elements
+ */
+ protected ILabelProvider labelProvider;
+
+ /**
+ * The currently chosen elements
+ */
+ protected final Collection<Object> allElements;
+
+ /**
+ * Indicates if the values should be unique (according to Object.equals())
+ */
+ protected boolean unique;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The shell in which this dialog should be opened
+ * @param selector
+ * The element selector used by this dialog
+ */
+ public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector) {
+ this(parentShell, selector, null, false);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The shell in which this dialog should be opened
+ * @param selector
+ * The element selector used by this dialog
+ * @param title
+ * The title of this dialog
+ */
+ public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, String title) {
+ this(parentShell, selector, title, false);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell
+ * The shell in which this dialog should be opened
+ * @param selector
+ * The element selector used by this dialog
+ * @param unique
+ * True if the values returned by this dialog should be unique
+ */
+ public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, boolean unique) {
+ this(parentShell, selector, null, unique);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell
+ * The shell in which this dialog should be opened
+ * @param selector
+ * The element selector used by this dialog
+ * @param title
+ * The title of this dialog
+ * @param unique
+ * True if the values returned by this dialog should be unique
+ */
+ public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique) {
+ super(parentShell);
+ Assert.isNotNull(selector, "The element selector should be defined"); //$NON-NLS-1$
+ this.selector = selector;
+ allElements = unique ? new LinkedHashSet<Object>() : new LinkedList<Object>();
+ setHelpAvailable(false);
+ setTitle(title);
+ this.unique = unique;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void create() {
+ super.create();
+
+ Composite parent = getDialogArea();
+ GridLayout layout = (GridLayout)parent.getLayout();
+ layout.numColumns = 4;
+ layout.makeColumnsEqualWidth = false;
+
+ createSelectorSection(parent);
+ createControlsSection(parent);
+ createListSection(parent);
+ createRightButtonsSection(parent);
+
+ getShell().setSize(400, 300);
+ getShell().layout();
+
+ setResult(new LinkedList<Object>(allElements));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Composite getDialogArea() {
+ return (Composite)super.getDialogArea();
+ }
+
+ /**
+ * Creates the selector section
+ *
+ * @param parent
+ * The composite in which the section is created
+ */
+ private void createSelectorSection(Composite parent) {
+ selectorSection = new Composite(parent, SWT.NONE);
+ selectorSection.setLayout(new FillLayout());
+ selectorSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ selector.createControls(selectorSection);
+ }
+
+ /**
+ * Creates the main controls section (Add, remove, Add all, remove all)
+ *
+ * @param parent
+ * The composite in which the section is created
+ */
+ private void createControlsSection(Composite parent) {
+ buttonsSection = new Composite(parent, SWT.NONE);
+ buttonsSection.setLayout(new GridLayout(1, true));
+
+ add = new Button(buttonsSection, SWT.PUSH);
+ add.setImage(Activator.getImage("/icons/arrow_right.gif")); //$NON-NLS-1$
+ add.addSelectionListener(this);
+ add.setToolTipText(Messages.MultipleValueSelectorDialog_AddSelectedElements);
+
+ remove = new Button(buttonsSection, SWT.PUSH);
+ remove.setImage(Activator.getImage("/icons/arrow_left.gif")); //$NON-NLS-1$
+ remove.addSelectionListener(this);
+ remove.setToolTipText(Messages.MultipleValueEditor_RemoveSelectedElements);
+
+ addAll = new Button(buttonsSection, SWT.PUSH);
+ addAll.setImage(Activator.getImage("/icons/arrow_double.gif")); //$NON-NLS-1$
+ addAll.addSelectionListener(this);
+ addAll.setToolTipText(Messages.MultipleValueSelectorDialog_AddAllElements);
+
+ removeAll = new Button(buttonsSection, SWT.PUSH);
+ removeAll.setImage(Activator.getImage("/icons/arrow_left_double.gif")); //$NON-NLS-1$
+ removeAll.addSelectionListener(this);
+ removeAll.setToolTipText(Messages.MultipleValueSelectorDialog_RemoveAllElements);
+ }
+
+ /**
+ * Creates the list displaying the currently selected elements
+ *
+ * @param parent
+ * The composite in which the section is created
+ */
+ private void createListSection(Composite parent) {
+
+ selectedElements = new List(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ selectedElements.setLayoutData(data);
+ selectedElementsViewer = new ListViewer(selectedElements);
+
+ selectedElementsViewer.setContentProvider(new CollectionContentProvider());
+
+ if(labelProvider != null)
+ selectedElementsViewer.setLabelProvider(labelProvider);
+
+ selectedElementsViewer.setInput(allElements);
+ selector.setSelectedElements(allElements.toArray());
+ }
+
+ /**
+ * Creates the up/down controls section
+ *
+ * @param parent
+ * The composite in which the section is created
+ */
+ private void createRightButtonsSection(Composite parent) {
+ rightButtonsSection = new Composite(parent, SWT.NONE);
+ rightButtonsSection.setLayout(new GridLayout(1, true));
+
+ up = new Button(rightButtonsSection, SWT.PUSH);
+ up.setImage(Activator.getImage("/icons/Up_12x12.gif")); //$NON-NLS-1$
+ up.addSelectionListener(this);
+ up.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsUp);
+
+ down = new Button(rightButtonsSection, SWT.PUSH);
+ down.setImage(Activator.getImage("/icons/Down_12x12.gif")); //$NON-NLS-1$
+ down.addSelectionListener(this);
+ down.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsDown);
+ }
+
+ /**
+ * Sets the label provider used to display the selected elements
+ *
+ * @param labelProvider
+ */
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ }
+
+ /**
+ * {@inheritDoc} Handles the events on one of the control buttons
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ *
+ * @param e
+ * The event that occurred
+ */
+ public void widgetSelected(SelectionEvent e) {
+ if(e.widget == add) {
+ addAction();
+ } else if(e.widget == remove) {
+ removeAction();
+ } else if(e.widget == addAll) {
+ addAllAction();
+ } else if(e.widget == removeAll) {
+ removeAllAction();
+ } else if(e.widget == up) {
+ upAction();
+ } else if(e.widget == down) {
+ downAction();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public int open() {
+ allElements.clear();
+ allElements.addAll(getInitialElementSelections());
+ return super.open();
+ }
+
+ /**
+ * Handles the "Add" action
+ */
+ protected void addAction() {
+ Object[] elements = selector.getSelectedElements();
+ addElements(elements);
+ }
+
+ /**
+ * Handles the "Up" action
+ */
+ protected void upAction() {
+ IStructuredSelection selection = (IStructuredSelection)selectedElementsViewer.getSelection();
+
+ //We need a list to move objects. LinkedHashSet can't do that
+ java.util.List<Object> list = new LinkedList<Object>(allElements);
+ for(Object o : selection.toArray()) {
+ int oldIndex = list.indexOf(o);
+ if(oldIndex > 0)
+ move(list, oldIndex, oldIndex - 1);
+ }
+
+ allElements.clear();
+ allElements.addAll(list);
+
+ IStructuredSelection selectionCopy = new StructuredSelection(selection.toArray());
+ selectedElementsViewer.setSelection(selectionCopy);
+ selectedElementsViewer.refresh();
+ }
+
+ /**
+ * Handles the "Down" action
+ */
+ protected void downAction() {
+ IStructuredSelection selection = (IStructuredSelection)selectedElementsViewer.getSelection();
+
+ //We need a list to move objects. LinkedHashSet can't do that
+ java.util.List<Object> list = new LinkedList<Object>(allElements);
+
+ int maxIndex = list.size() - 1;
+
+ Object[] selectionArray = selection.toArray();
+ for(int i = selectionArray.length - 1; i >= 0; i--) {
+ Object o = selectionArray[i];
+ int oldIndex = list.indexOf(o);
+ if(oldIndex < maxIndex)
+ move(list, oldIndex, oldIndex + 1);
+ }
+
+ allElements.clear();
+ allElements.addAll(list);
+
+ IStructuredSelection selectionCopy = new StructuredSelection(selection.toArray());
+ selectedElementsViewer.setSelection(selectionCopy);
+ selectedElementsViewer.refresh();
+ }
+
+ /**
+ * Moves an element from oldIndex to newIndex
+ *
+ * @param list
+ * The list in which to move the object
+ * @param oldIndex
+ * @param newIndex
+ */
+ private void move(java.util.List<Object> list, int oldIndex, int newIndex) {
+ int size = list.size();
+
+ if(oldIndex < 0 || oldIndex >= size)
+ throw new IndexOutOfBoundsException("oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$
+ if(newIndex < 0 || newIndex >= size)
+ throw new IndexOutOfBoundsException("newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$
+ Object element = list.remove(oldIndex);
+ list.add(newIndex, element);;
+ }
+
+ /**
+ * Handles the "Remove" action
+ */
+ protected void removeAction() {
+ IStructuredSelection selection = (IStructuredSelection)selectedElementsViewer.getSelection();
+ if(selection.isEmpty())
+ return;
+
+ for(Object element : selection.toArray()) {
+ allElements.remove(element);
+ }
+
+ selector.setSelectedElements(allElements.toArray());
+ selectedElementsViewer.setSelection(null);
+ selectedElementsViewer.refresh();
+
+ setResult(new LinkedList<Object>(allElements));
+ }
+
+ /**
+ * Handles the "Remove all" action
+ */
+ protected void removeAllAction() {
+ allElements.clear();
+ selector.setSelectedElements(new Object[0]);
+ setResult(new LinkedList<Object>());
+ selectedElementsViewer.setSelection(null);
+ selectedElementsViewer.refresh();
+ }
+
+ /**
+ * Handles the "Add All" action
+ */
+ protected void addAllAction() {
+ Object[] elements = selector.getAllElements();
+ addElements(elements);
+ }
+
+ /**
+ * Adds the specified elements to the currently selected elements (For
+ * "Add" and "Add all" actions)
+ *
+ * @param elements
+ * The elements to be added
+ */
+ private void addElements(Object[] elements) {
+ if(elements != null) {
+ allElements.addAll(Arrays.asList(elements));
+ selectedElementsViewer.refresh();
+
+ setResult(new LinkedList<Object>(allElements));
+ }
+ }
+
+ /**
+ * Ignored
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+
+ /**
+ * Indicates if the selected values should be unique (According to Object.equals())
+ *
+ * @param unique
+ */
+ public void setUnique(boolean unique) {
+ this.unique = unique;
+ }
+
+ /**
+ * Indicates if the selected elements should be ordered
+ *
+ * @param ordered
+ */
+ public void setOrdered(boolean ordered) {
+ if(ordered && rightButtonsSection == null) {
+ createRightButtonsSection(getDialogArea());
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/ReferenceCombo.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/ReferenceCombo.java
new file mode 100644
index 00000000000..034a4320f61
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/ReferenceCombo.java
@@ -0,0 +1,143 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.databinding.viewers.ViewerProperties;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.editors.providers.EncapsulatedContentProvider;
+import org.eclipse.papyrus.editors.providers.IStaticContentProvider;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * An editor representing a single reference as a Combo Box
+ * This Editor needs a ContentProvider and a LabelProvider,
+ * describing the objects that can be referred by this property
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ReferenceCombo extends AbstractValueEditor {
+
+ /**
+ * The viewer displaying the available values from the model
+ */
+ private ComboViewer viewer;
+
+ /**
+ * The displayed control
+ */
+ private CCombo control;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The Composite in which this editor is diplayed
+ * @param style
+ * The style for this editor's combo
+ */
+ public ReferenceCombo(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The Composite in which this editor is diplayed
+ * @param style
+ * The style for this editor's combo
+ * @param label
+ * The label for this editor
+ */
+ public ReferenceCombo(Composite parent, int style, String label) {
+ super(parent, label);
+
+ control = factory.createCCombo(this, style);
+ control.setLayoutData(getDefaultLayoutData());
+ //control = new CCombo(this, style);
+ control.setEditable(false);
+ viewer = new ComboViewer(control);
+ }
+
+ /**
+ * Sets the Content and Label providers for this editor
+ *
+ * @param contentProvider
+ *
+ * @param labelProvider
+ */
+ public void setProviders(IStaticContentProvider contentProvider, ILabelProvider labelProvider) {
+ Assert.isNotNull(contentProvider, "The content provider should not be null"); //$NON-NLS-1$
+ setContentProvider(contentProvider);
+
+ if(labelProvider != null)
+ setLabelProvider(labelProvider);
+ }
+
+ /**
+ * Sets the content provider for this combo. The Content provider should
+ * specify the objects that can be referred by this property
+ *
+ * @param provider
+ */
+ public void setContentProvider(IStaticContentProvider provider) {
+ viewer.setContentProvider(new EncapsulatedContentProvider(provider));
+ viewer.setInput(""); //$NON-NLS-1$
+ setWidgetObservable(ViewerProperties.singleSelection().observe(viewer));
+ }
+
+ /**
+ * The Label provider associated to the available objects that
+ * can be referred by this property
+ *
+ * @param provider
+ */
+ public void setLabelProvider(ILabelProvider provider) {
+ viewer.setLabelProvider(provider);
+ }
+
+ /**
+ * Retrieves the ComboViewer associated to this Editor
+ *
+ * @return
+ */
+ public ComboViewer getViewer() {
+ return viewer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Object.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getValue() {
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ if(selection.isEmpty())
+ return null;
+ return selection.getFirstElement();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/StringEditor.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/StringEditor.java
new file mode 100644
index 00000000000..bc539f4924f
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/StringEditor.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors;
+
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * A Property Editor representing a single-line String value
+ * as a Text.
+ * This editor's content is validated when the focus is lost,
+ * or when the Carriage Return is pressed.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class StringEditor extends AbstractValueEditor implements KeyListener {
+
+ /**
+ * The text box for editing this editor's value
+ */
+ protected Text text;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor should be displayed
+ * @param style
+ * The style for this editor's text box
+ */
+ public StringEditor(Composite parent, int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor should be displayed
+ * @param style
+ * The style for this editor's text box
+ * @param label
+ * The label for this editor
+ */
+ public StringEditor(Composite parent, int style, String label) {
+ super(parent, label);
+
+ text = factory.createText(this, null, style);
+ text.setLayoutData(getDefaultLayoutData());
+ //text = new Text(this, style);
+
+ //We listen on Carriage Return only if the editor isn't multiline
+ if((style & SWT.MULTI) == 0)
+ text.addKeyListener(this);
+
+ setWidgetObservable(WidgetProperties.text(SWT.FocusOut).observe(text));
+ }
+
+ /**
+ * Ignored
+ */
+ public void keyPressed(KeyEvent e) {
+ //Nothing
+ }
+
+ /**
+ * Validates this editor when one of the following events occur :
+ * - CR released
+ * - Keypad CR released
+ *
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ *
+ * @param e
+ */
+ public void keyReleased(KeyEvent e) {
+ if((e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) && e.stateMask == SWT.NONE) {
+ text.notifyListeners(SWT.FocusOut, new Event());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return String.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getValue() {
+ return text.getText();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/Messages.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/Messages.java
new file mode 100644
index 00000000000..65aa38eb932
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/Messages.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The Class Messages.
+ */
+public class Messages extends NLS {
+
+ /** The Constant BUNDLE_NAME. */
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.editors.messages"; //$NON-NLS-1$
+
+ /** The Multiple value editor_ add elements. */
+ public static String MultipleValueEditor_AddElements;
+
+ /** The Multiple value editor_ move selected elements down. */
+ public static String MultipleValueEditor_MoveSelectedElementsDown;
+
+ /** The Multiple value editor_ move selected elements up. */
+ public static String MultipleValueEditor_MoveSelectedElementsUp;
+
+ /** The Multiple value editor_ remove selected elements. */
+ public static String MultipleValueEditor_RemoveSelectedElements;
+
+ /** The Multiple value selector dialog_ add all elements. */
+ public static String MultipleValueSelectorDialog_AddAllElements;
+
+ /** The Multiple value selector dialog_ add selected elements. */
+ public static String MultipleValueSelectorDialog_AddSelectedElements;
+
+ /** The Multiple value selector dialog_ remove all elements. */
+ public static String MultipleValueSelectorDialog_RemoveAllElements;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * Instantiates a new messages.
+ */
+ private Messages() {
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/messages.properties b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/messages.properties
new file mode 100644
index 00000000000..67498d97ed1
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/messages/messages.properties
@@ -0,0 +1,7 @@
+MultipleValueEditor_AddElements=Add elements
+MultipleValueEditor_MoveSelectedElementsDown=Move selected elements down
+MultipleValueEditor_MoveSelectedElementsUp=Move selected elements up
+MultipleValueEditor_RemoveSelectedElements=Remove selected elements
+MultipleValueSelectorDialog_AddAllElements=Add all elements
+MultipleValueSelectorDialog_AddSelectedElements=Add selected elements
+MultipleValueSelectorDialog_RemoveAllElements=Remove all elements
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/CollectionContentProvider.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/CollectionContentProvider.java
new file mode 100644
index 00000000000..111f2d87a8f
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/CollectionContentProvider.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.providers;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A Content Provider converting the input list to an array containing the same elements
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class CollectionContentProvider implements IStructuredContentProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ //Nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //Nothing
+ }
+
+ /**
+ * Converts the input List to an Array containing the same elements
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof Collection) {
+ return ((Collection<?>)inputElement).toArray();
+ } else if(inputElement instanceof Object[]) {
+ return (Object[])inputElement;
+ }
+
+ return new Object[]{};
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/EncapsulatedContentProvider.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/EncapsulatedContentProvider.java
new file mode 100644
index 00000000000..46815ba1b06
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/EncapsulatedContentProvider.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.providers;
+
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A ContentProvider to adapt an IStaticContentProvider to an IStructurecContentProvider
+ * Useful when you need to use a ContentProvider that doesn't depend on its Input Object
+ * to return values in a JFace Viewer.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class EncapsulatedContentProvider implements IStructuredContentProvider {
+
+ /**
+ * The encapsulated static content provider
+ */
+ private IStaticContentProvider encapsulated;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param encapsulated
+ * The encapsulated static content provider
+ */
+ public EncapsulatedContentProvider(IStaticContentProvider encapsulated) {
+ this.encapsulated = encapsulated;
+ }
+
+ /**
+ * Sets the objects that should not be returned by this provider
+ *
+ * @param filtered
+ */
+ public void setFilteredElements(Object[] filtered) {
+ filteredElements.clear();
+ addFilteredElements(filtered);
+ }
+
+ /**
+ * Adds elements that should not be returned by this provider
+ *
+ * @param filtered
+ */
+ public void addFilteredElements(Object[] filtered) {
+ for(Object object : filtered) {
+ filteredElements.add(object);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getElements(Object inputElement) {
+ return getElements();
+ }
+
+ /**
+ * Gets the elements for this content provider
+ *
+ * @return
+ */
+ public Object[] getElements() {
+ Object[] allElements = encapsulated.getElements();
+ Set<Object> result = new LinkedHashSet<Object>();
+ for(Object element : allElements) {
+ if(!filteredElements.contains(element)) {
+ result.add(element);
+ }
+ }
+ return result.toArray();
+ }
+
+ /**
+ * The set of elements that should not be returned by this provider
+ */
+ private Set<Object> filteredElements = new HashSet<Object>();
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/IStaticContentProvider.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/IStaticContentProvider.java
new file mode 100644
index 00000000000..a55e5ecfc7a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/providers/IStaticContentProvider.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.providers;
+
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * A ContentProvider which returns values that don't depend
+ * on an input value
+ *
+ * @author Camille Letavernier
+ *
+ */
+public interface IStaticContentProvider extends IContentProvider {
+
+ /**
+ * @return the elements provided by this class
+ */
+ public Object[] getElements();
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java
new file mode 100644
index 00000000000..914e703f4bb
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.selectors;
+
+/**
+ * A Selector for Integer values
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class IntegerSelector extends StringSelector {
+
+ /**
+ * {@inheritDoc}
+ */
+ public IntegerSelector() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Integer[] getSelectedElements() {
+ Integer[] result;
+ try {
+ result = new Integer[]{ Integer.parseInt(text.getText()) };
+ text.setText(""); //$NON-NLS-1$
+ } catch (NumberFormatException ex) {
+ result = new Integer[]{};
+ }
+ return result;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/ReferenceSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/ReferenceSelector.java
new file mode 100644
index 00000000000..44f2f49bae4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/ReferenceSelector.java
@@ -0,0 +1,256 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.selectors;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.editors.IElementSelector;
+import org.eclipse.papyrus.editors.providers.EncapsulatedContentProvider;
+import org.eclipse.papyrus.editors.providers.IStaticContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredList;
+
+
+/**
+ * A Selector for Multiple Refrence values, with a filter
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ReferenceSelector implements IElementSelector {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param unique
+ * Indicates if the values are unique. If true, they are removed
+ * from the list when they are chosen
+ */
+ public ReferenceSelector(boolean unique) {
+ this.unique = unique;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getSelectedElements() {
+ Object[] selectedElements = fList.getSelection();
+ addSelectedElements(selectedElements);
+ return selectedElements;
+ }
+
+ /**
+ * Adds elements to the list of selected elements. If the values are
+ * unique, the specified elements won't be displayed
+ *
+ * @param elements
+ */
+ private void addSelectedElements(Object[] elements) {
+ if(unique && elements.length > 0) {
+ contentProvider.addFilteredElements(elements);
+ fList.setElements(contentProvider.getElements());
+ }
+ }
+
+ /**
+ * Returns all the elements that are currently displayed, i.e. matching
+ * the filter
+ *
+ * @see org.eclipse.papyrus.editors.IElementSelector#getAllElements()
+ *
+ * @return all elements matching the filter
+ */
+ public Object[] getAllElements() {
+ //There is no way to retrieve the filteredElements on a FList
+ //We can only retrieve the selected ones
+ //Fix : we select everything, then we return the selection
+ fList.setSelection(contentProvider.getElements());
+ Object[] allElements = fList.getSelection();
+ addSelectedElements(allElements);
+ return allElements;
+ }
+
+ /**
+ * Sets the list of selected elements. If the values are
+ * unique, the specified elements won't be displayed
+ *
+ * @param elements
+ */
+ public void setSelectedElements(Object[] elements) {
+ if(unique) {
+ contentProvider.setFilteredElements(elements);
+ fList.setElements(contentProvider.getElements());
+ }
+ }
+
+ /**
+ * Sets this selector's label provider. The label provider is used
+ * to display the reference values
+ *
+ * @param labelProvider
+ */
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ if(fList != null) {
+ fList.setLabelProvider(labelProvider);
+ }
+ }
+
+ /**
+ * Sets this selector's content provider. The content provider
+ * is used to select the available values for this property
+ *
+ * @param staticContentProvider
+ */
+ public void setContentProvider(IStaticContentProvider staticContentProvider) {
+ this.contentProvider = new EncapsulatedContentProvider(staticContentProvider);
+ if(fList != null) {
+ fList.setElements(contentProvider.getElements());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createControls(Composite parent) {
+ Composite content = new Composite(parent, SWT.BORDER);
+ content.setLayout(new GridLayout(1, true));
+
+ filter = new Filter(content, SWT.BORDER);
+ filter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ fList = new FilteredList(content, SWT.MULTI | SWT.BORDER, labelProvider, true, true, true);
+ fList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ if(contentProvider != null) {
+ fList.setElements(contentProvider.getElements());
+ }
+
+ filter.addChangeListener(new Listener() {
+
+ public void handleEvent(Event event) {
+ fList.setFilter(filter.getFilter());
+ }
+ });
+ }
+
+ /**
+ * A Widget to enter a filter as a String, accepting wildcards
+ */
+ protected Filter filter;
+
+ /**
+ * The display list
+ */
+ protected FilteredList fList;
+
+ /**
+ * The content provider, returning the available reference values
+ */
+ protected EncapsulatedContentProvider contentProvider;
+
+ /**
+ * The content provider, returning the available reference labels
+ */
+ protected ILabelProvider labelProvider;
+
+ /**
+ * Indicates if the reference values should be unique
+ */
+ protected boolean unique;
+
+ /**
+ * A Text field to let the user type its own filter
+ *
+ * @author Camille Letavernier
+ *
+ */
+ private class Filter extends Composite implements KeyListener {
+
+ /**
+ * The text box used to edit the filter
+ */
+ private Text text;
+
+ /**
+ * @param parent
+ * The composite in which the filter should be created
+ * @param style
+ * The style applied to this filter's text box
+ */
+ public Filter(Composite parent, int style) {
+ super(parent, SWT.NONE);
+ setLayout(new FillLayout());
+ text = new Text(this, style);
+ text.addKeyListener(this);
+ listeners = new LinkedList<Listener>();
+ }
+
+ /**
+ * @return this filter as a String
+ */
+ public String getFilter() {
+ return text.getText();
+ }
+
+ /**
+ * Adds a listener on this filter. The listener is notified
+ * each time the filter changes
+ *
+ * @param listener
+ */
+ public void addChangeListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Removes the specified Listener from this filter
+ *
+ * @param listener
+ */
+ public void removeChangeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Ignored
+ */
+ public void keyPressed(KeyEvent e) {
+ //Nothing
+ }
+
+ /**
+ * Handles the filter change event
+ */
+ public void keyReleased(KeyEvent e) {
+ for(Listener listener : listeners) {
+ listener.handleEvent(null);
+ }
+ }
+
+ /**
+ * All registered listeners
+ */
+ private Collection<Listener> listeners;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StandardSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StandardSelector.java
new file mode 100644
index 00000000000..d7cd22f6d2b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StandardSelector.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.selectors;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.papyrus.editors.AbstractValueEditor;
+import org.eclipse.papyrus.editors.Activator;
+import org.eclipse.papyrus.editors.IElementSelector;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Creates an element selector from an AbstractValueEditor. This class is a
+ * generic implementation for element selectors.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class StandardSelector implements IElementSelector {
+
+ /**
+ * The AbstractValueEditor class used for instantiating this selector
+ */
+ private Class<? extends AbstractValueEditor> editorClass;
+
+ /**
+ * The AbstractValueEditor used by this selecotr
+ */
+ private AbstractValueEditor editor;
+
+ /**
+ * Instantiates this selector, using the specified editor class
+ *
+ * @param editorClass
+ * The AbstractValueEditor Class used to instantiate this selector
+ */
+ public StandardSelector(Class<? extends AbstractValueEditor> editorClass) {
+ Assert.isNotNull(editorClass, "The StandardSelector editor class should not be null"); //$NON-NLS-1$
+ this.editorClass = editorClass;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getSelectedElements() {
+ Object value = editor.getValue();
+ if(value == null)
+ return new Object[]{};
+
+ return new Object[]{ value };
+ }
+
+ /**
+ * Ignored. The generic selectors can't be filtered.
+ */
+ public void setSelectedElements(Object[] elements) {
+ //Ignored
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getAllElements() {
+ return getSelectedElements();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The control for this selector is obtained by instantiating the generic class with a parent
+ * composite and a default style
+ */
+ public void createControls(Composite parent) {
+ try {
+ Constructor<? extends AbstractValueEditor> construct = editorClass.getDeclaredConstructor(Composite.class, Integer.TYPE);
+ editor = construct.newInstance(parent, SWT.BORDER);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StringSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StringSelector.java
new file mode 100644
index 00000000000..2919f93eb2a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/StringSelector.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.selectors;
+
+import org.eclipse.papyrus.editors.IElementSelector;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * A selector for String values, or values that can be represented
+ * as text in general.
+ * Displays a field where the user can enter the new values.
+ * The field can be multiline or single line
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class StringSelector implements IElementSelector {
+
+ /**
+ * The text box used to enter a value for this selector
+ */
+ protected Text text;
+
+ /**
+ * Indicates if this StringSelector is multiline
+ */
+ protected boolean multiline;
+
+ /**
+ * Constructs a single-line String Selector
+ */
+ public StringSelector() {
+ this(false);
+ }
+
+ /**
+ * Constructs a String Selector
+ *
+ * @param multiline
+ * True if the string values can contain more than one line
+ */
+ public StringSelector(boolean multiline) {
+ this.multiline = multiline;
+ }
+
+ /**
+ * Returns a single-element array containing the current text
+ *
+ * @see org.eclipse.papyrus.editors.IElementSelector#getSelectedElements()
+ *
+ * @return
+ */
+ public Object[] getSelectedElements() {
+ String[] result = new String[]{ text.getText() };
+ text.setText(""); //$NON-NLS-1$
+ return result;
+ }
+
+ /**
+ * Ignored
+ */
+ public void setSelectedElements(Object[] elements) {
+ //Nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createControls(Composite parent) {
+ text = new Text(parent, multiline ? SWT.MULTI : SWT.NONE);
+ }
+
+ /**
+ * Returns the same value as getSelectedElements
+ *
+ * @see org.eclipse.papyrus.editors.IElementSelector#getAllElements()
+ *
+ * @return
+ */
+ public Object[] getAllElements() {
+ return getSelectedElements();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
index d61288e8e7a..66e65c00175 100644
--- a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.extensionpoints.editors;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.extensionpoints.editors.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui.editors;bundle-version="3.4.0",
diff --git a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/plugin.properties b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
index 4bf80c6fc96..15bd7ad3945 100644
--- a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
@@ -9,4 +9,4 @@
# Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
##################################################################################
pluginName=Papyrus Embedded Editors extensions point (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.log/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.log/META-INF/MANIFEST.MF
index a55a6a29d80..383e31dfd31 100644
--- a/plugins/core/org.eclipse.papyrus.log/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.log/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.log
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.log.internal.Activator
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
diff --git a/plugins/core/org.eclipse.papyrus.log/plugin.properties b/plugins/core/org.eclipse.papyrus.log/plugin.properties
index f7dc52efc54..e3c14aca713 100644
--- a/plugins/core/org.eclipse.papyrus.log/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.log/plugin.properties
@@ -12,4 +12,4 @@
#
##################################################################################
pluginName=Papyrus Logging plugin(Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.modelexplorer/META-INF/MANIFEST.MF
index b89c3c6425a..1098df43469 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.modelexplorer;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.modelexplorer.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -23,7 +24,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gmt.modisco.infra.facet;bundle-version="0.8.0",
org.eclipse.gmt.modisco.infra.facet.core;bundle-version="0.8.0",
org.eclipse.emf.workspace.ui;bundle-version="1.3.0",
- org.eclipse.core.expressions;bundle-version="3.4.200"
+ org.eclipse.core.expressions;bundle-version="3.4.200",
+ org.eclipse.papyrus.service.edit;bundle-version="0.7.1",
+ org.apache.commons.lang;bundle-version="2.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/about.html b/plugins/core/org.eclipse.papyrus.modelexplorer/about.html
new file mode 100644
index 00000000000..dd02e0be168
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>December 2, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/build.properties b/plugins/core/org.eclipse.papyrus.modelexplorer/build.properties
index 28600904cf6..b1f01ee5ca7 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/build.properties
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/build.properties
@@ -5,7 +5,7 @@ bin.includes = META-INF/,\
plugin.xml,\
icons/,\
schema/,\
- bin/,\
- plugin.properties
+ plugin.properties,\
+ about.html
src.includes = schema/,\
icons/
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/sort.gif b/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/sort.gif
new file mode 100644
index 00000000000..866c40af135
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/sort.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/validate.gif b/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/validate.gif
new file mode 100644
index 00000000000..a7753cd9c01
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/icons/etool16/validate.gif
Binary files differ
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.properties b/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.properties
index f9e77bdafc2..2a1fa306766 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.properties
@@ -11,8 +11,8 @@
# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
#
########################################################################################
-pluginName=Model Explorer (Incubation)
-providerName=Eclipse.org
+pluginName=Papyrus Model Explorer (Incubation)
+providerName=Eclipse Modeling Project
navigatorContent= Model Contents
executequery=Execute Query...
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.xml b/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.xml
index 8100e6a375b..a1b51a46c96 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.xml
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/plugin.xml
@@ -45,7 +45,7 @@
activeByDefault="false"
contentProvider="org.eclipse.papyrus.modelexplorer.MoDiscoContentProvider"
id="org.eclipse.papyrus.modelexplorer.navigatorContent"
- labelProvider="org.eclipse.papyrus.modelexplorer.MoDiscoLabelProvider"
+ labelProvider="org.eclipse.papyrus.modelexplorer.MoDiscoLabelProviderWTooltips"
name="Model Contents"
priority="lowest">
<triggerPoints>
@@ -62,7 +62,10 @@
</or></triggerPoints>
<possibleChildren>
<or>
- <instanceof value="org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.ModelElementItem"/>
+ <instanceof
+ value="org.eclipse.gmf.runtime.notation.impl.DiagramImpl">
+ </instanceof>
+ <instanceof value="org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.ModelElementItem"/>
</or>
</possibleChildren>
<actionProvider
@@ -76,22 +79,6 @@
</or>
</enablement>
</actionProvider>
- <actionProvider
- class="org.eclipse.papyrus.modelexplorer.actionprovider.CreateDiagramActionProvider"
- id="org.eclipse.papyrus.modelexplorer.actionprovider.CreateDiagramActionProvider">
- <enablement>
- <and>
- <not>
- <instanceof
- value="org.eclipse.gmf.runtime.notation.Diagram">
- </instanceof>
- </not>
- <adapt
- type="org.eclipse.emf.ecore.EObject">
- </adapt>
- </and>
- </enablement>
- </actionProvider>
<actionProvider
class="org.eclipse.papyrus.modelexplorer.actionprovider.EditingDomainActionProvider"
@@ -123,7 +110,15 @@
<dropAssistant
class="org.eclipse.papyrus.modelexplorer.dnd.CommonDropAdapterAssistant"
id="org.eclipse.papyrus.modelexplorer.dnd.CommonDropAdapterAssistant">
- <possibleDropTargets></possibleDropTargets>
+ <possibleDropTargets>
+ <or>
+ <instanceof
+ value="org.eclipse.gmf.runtime.notation.impl.DiagramImpl">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.ModelElementItem">
+ </instanceof>
+ </or></possibleDropTargets>
</dropAssistant>
</navigatorContent>
@@ -161,50 +156,180 @@
needSeparator="true">
</customAction>
</extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="toolbar:org.eclipse.papyrus.modelexplorer.modelexplorer">
- <command
- commandId="org.eclipse.papyrus.modelexplorer.LoadBrowserCustomization"
- icon="icons/etool16/uiCustom.gif"
- label="Load browser customization"
- style="push">
- </command>
- <command
- commandId="org.eclipse.papyrus.modelexplorer.searchelement"
- icon="icons/etool16/search.gif"
- label="Search element"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.modelexplorer.modelexplorer.popup">
- <menu
- id="org.eclipse.papyrus.modelexplorer.popupmenu.createchild"
- label="New Child">
- </menu>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.modelexplorer.handler.LoadBrowserCustomization"
- description="Load a customization for the papyrus browser"
- id="org.eclipse.papyrus.modelexplorer.LoadBrowserCustomization"
- name="loadBrowserCustomization">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.modelexplorer.handler.SearchElementHandler"
- description="Search an element in the model explorer"
- id="org.eclipse.papyrus.modelexplorer.searchelement"
- name="searchelement">
- </command>
- </extension>
+
+<extension point="org.eclipse.ui.menus">
+
+ <!-- ModelExplorer toolbar -->
+ <menuContribution locationURI="toolbar:org.eclipse.papyrus.modelexplorer.modelexplorer"
+ allPopups="false">
+
+ <!-- Load modisco browser customization command -->
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.LoadBrowserCustomization"
+ icon="icons/etool16/uiCustom.gif"
+ label="Load browser customization"
+ style="push">
+ </command>
+
+ <!-- Search element command -->
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.searchelement"
+ icon="icons/etool16/search.gif"
+ label="Search element"
+ style="push">
+ </command>
+
+ <!-- Sort elements command -->
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.sortelement"
+ icon="icons/etool16/sort.gif"
+ label="sort"
+ style="toggle">
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.modelexplorer.modelexplorer.popup">
+ <menu
+ id="org.eclipse.papyrus.modelexplorer.popupmenu.createchild"
+ label="New Child">
+ </menu>
+ <menu
+ id="org.eclipse.papyrus.modelexplorer.popupmenu.creatediagram"
+ label="New Diagram">
+ </menu>
+ <command
+ commandId="org.eclipse.ui.edit.delete"
+ disabledIcon="IMG_TOOL_DELETE_DISABLED"
+ icon="IMG_TOOL_DELETE"
+ label="Delete"
+ style="push"
+ tooltip="Delete">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <with
+ variable="selection">
+ <iterate>
+ <adapt
+ type="org.eclipse.emf.ecore.EObject">
+ </adapt>
+ </iterate>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ <menu
+ icon="icons/etool16/validate.gif"
+ id="org.eclipse.papyrus.modelexplorer.popup.validation"
+ label="Validation"
+ path="papyrus">
+ </menu>
+ </menuContribution>
+ <!-- ModelExplorer Contextual menu -->
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.modelexplorer.popup.validation">
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.ValidateModelCommand"
+ icon="icons/etool16/validate.gif"
+ id="org.eclipse.papyrus.modelexplorer.ValidateModel"
+ label="Validate model"
+ tooltip="Validate model">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ commandId="org.eclipse.papyrus.modelexplorer.ValidateSubtreeCommand"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.ValidateModelHandler"
+ description="Validate Model"
+ icon="icons/etool16/validate.gif"
+ id="org.eclipse.papyrus.modelexplorer.ValidateSubtree"
+ label="Validate subtree"
+ name="Validate Model"
+ tooltip="Validate subtree">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.ValidateDelMarkersFromModelCommand"
+ disabledIcon="IMG_TOOL_DELETE_DISABLED"
+ icon="IMG_TOOL_DELETE"
+ id="org.eclipse.papyrus.modelexplorer.DeleteMarkersFromModel"
+ label="Remove markers from model"
+ tooltip="Validate model">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.modelexplorer.ValidateDelMarkersFromSubtreeCommand"
+ disabledIcon="IMG_TOOL_DELETE_DISABLED"
+ icon="IMG_TOOL_DELETE"
+ id="org.eclipse.papyrus.modelexplorer.DelMarkersFromSubtree"
+ label="Remove markers from subtree"
+ tooltip="Validate model">
+ </command>
+ <!-- <visibleWhen checkEnabled="true"/> -->
+ </menuContribution>
+
+</extension>
+
+<!-- Command declarations (for model explorer toolbar and contextual menu -->
+<extension point="org.eclipse.ui.commands">
+
+ <!-- Command declaration : Load modisco browser customization command -->
+ <command id="org.eclipse.papyrus.modelexplorer.LoadBrowserCustomization"
+ name="loadBrowserCustomization" description="Load a customization for the papyrus browser"
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.LoadBrowserCustomization">
+ </command>
+
+ <!-- Command declaration : Search element command -->
+ <command id="org.eclipse.papyrus.modelexplorer.searchelement"
+ name="searchelement" description="Search an element in the model explorer"
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.SearchElementHandler">
+ </command>
+
+ <!-- Command declaration : Sort elements command -->
+ <command id="org.eclipse.papyrus.modelexplorer.sortelement"
+ name="SortElement" description="Sort elements"
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.SortElementHandler">
+ </command>
+
+ <!-- Command declaration : Delete element command -->
+ <command id="org.eclipse.papyrus.uml.service.creation.DeleteCommand"
+ name="Delete" description="Delete"
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.DeleteCommandHandler">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.ValidateModelHandler"
+ description="ValidateModel"
+ id="org.eclipse.papyrus.modelexplorer.ValidateModelCommand"
+ name="ValidateModel">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.ValidateSubtreeHandler"
+ description="ValidateSubtree"
+ id="org.eclipse.papyrus.modelexplorer.ValidateSubtreeCommand"
+ name="ValidateSubtree">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.ValidateDelMarkersFromModelHandler"
+ description="ValidateDelMarkersFromModel"
+ id="org.eclipse.papyrus.modelexplorer.ValidateDelMarkersFromModelCommand"
+ name="ValidateDelMarkersFromModel">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.modelexplorer.handler.ValidateDelMarkersFromSubtreeHandler"
+ description="ValidateDelMarkersFromSubtree"
+ id="org.eclipse.papyrus.modelexplorer.ValidateDelMarkersFromSubtreeCommand"
+ name="ValidateDelMarkersFromSubtree">
+ </command>
+</extension>
+
+
<extension point="org.eclipse.core.runtime.preferences">
<?gmfgen generated="false"?>
<initializer class="org.eclipse.papyrus.modelexplorer.preferences.NavigatorPreferenceInitializer"/>
@@ -219,4 +344,50 @@
</page>
</extension>
+<!-- This declaration is added in order command (DeleteCommandHandler) status to be
+ verified (isVisible and isEnabled) before any attempt to execute the command,
+ and to mask the command in case it is not supported or executable.
+ -->
+<extension point="org.eclipse.ui.startup">
+ <startup class="org.eclipse.papyrus.modelexplorer.Activator"/>
+</extension>
+<extension
+ point="org.eclipse.ui.navigator.linkHelper">
+ <linkHelper
+ class="org.eclipse.papyrus.modelexplorer.LinkHelper"
+ id="org.eclipse.papyrus.modelexplorer.linkHelper">
+ <selectionEnablement>
+ <instanceof
+ value="java.lang.Object">
+ </instanceof>
+ </selectionEnablement>
+ <editorInputEnablement>
+ <instanceof
+ value="org.eclipse.ui.part.IFileEditorInput">
+ </instanceof>
+ </editorInputEnablement>
+ </linkHelper>
+</extension>
+
+<!-- This service listen the selection, ensures that the modelExplorer is active, and update the
+ deleteInModelExplorer variable according to the selection.
+ -->
+<extension point="org.eclipse.ui.services">
+ <sourceProvider provider="org.eclipse.papyrus.modelexplorer.provider.ActionStateSourceProvider">
+ <variable name="deleteInModelExplorer" priorityLevel="workbench" />
+ </sourceProvider>
+</extension>
+
+<!-- This handler is activated when deleteInModelExplorer variable is valid.
+ -->
+<extension point="org.eclipse.ui.handlers">
+ <handler commandId="org.eclipse.ui.edit.delete" class="org.eclipse.papyrus.modelexplorer.handler.DeleteCommandHandler">
+ <activeWhen>
+ <with variable="deleteInModelExplorer">
+ <equals value="enabled" />
+ </with>
+ </activeWhen>
+ </handler>
+</extension>
+
</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/Activator.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/Activator.java
index 65a0b403322..729c9ff2857 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/Activator.java
@@ -34,20 +34,18 @@ import org.osgi.framework.BundleContext;
* The activator class controls the plug-in life cycle
*/
@SuppressWarnings("restriction")
-public class Activator extends AbstractUIPlugin {
+public class Activator extends AbstractUIPlugin implements org.eclipse.ui.IStartup {
- // The plug-in ID
+ /** The plug-in ID */
public static final String PLUGIN_ID = "org.eclipse.papyrus.modelexplorer"; //$NON-NLS-1$
- // The shared instance
+ /** The plug-in shared instance */
private static Activator plugin;
- /** The shared log helper. */
+ /** The log service */
public static LogHelper log;
- /**
- * The constructor
- */
+ /** Default constructor */
public Activator() {
}
@@ -148,4 +146,13 @@ public class Activator extends AbstractUIPlugin {
}
}
+ /**
+ *
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ *
+ */
+ public void earlyStartup() {
+
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/CustomCommonViewer.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/CustomCommonViewer.java
new file mode 100644
index 00000000000..4c48bb62466
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/CustomCommonViewer.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.internal.navigator.dnd.NavigatorDnDService;
+import org.eclipse.ui.navigator.CommonDragAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonViewer;
+/**
+ * this class was created in order to access to the drop adapter
+ *
+ */
+@SuppressWarnings("restriction")
+public class CustomCommonViewer extends CommonViewer {
+ protected CommonDropAdapter dropAdapter;
+
+ public CustomCommonViewer(String aViewerId, Composite aParent, int aStyle) {
+ super(aViewerId, aParent, aStyle);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void initDragAndDrop() {
+ dropAdapter=null;
+ int operations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+
+ CommonDragAdapter dragAdapter = createDragAdapter();
+ addDragSupport(operations, dragAdapter.getSupportedDragTransfers(),
+ dragAdapter);
+ dropAdapter = createDropAdapter();
+ addDropSupport(operations, dropAdapter.getSupportedDropTransfers(),
+ dropAdapter);
+
+ NavigatorDnDService dnd = (NavigatorDnDService)getNavigatorContentService().getDnDService();
+ dnd.setDropAdaptor(dropAdapter);
+ }
+
+ /**
+ * get the listener in order to parameterize during the runtime the drop
+ * @return the dropadapter
+ */
+ public CommonDropAdapter getDropAdapter() {
+ return dropAdapter;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ITooltip.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ITooltip.java
new file mode 100644
index 00000000000..0e14e56ffd7
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ITooltip.java
@@ -0,0 +1,67 @@
+package org.eclipse.papyrus.modelexplorer;
+
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * Interface containing operations from {@Link org.eclipse.jface.viewers.CellLabelProvider}
+ * It's a design fault that no interface has been defined by jface in the first place.
+ *
+ * @author ansgar
+ *
+ */
+public interface ITooltip {
+ /**
+ * @see CellLabelProvider
+ *
+ * @param object
+ * the element for which the tool tip is shown
+ * @return {@link Image} or <code>null</code> if there is not image.
+ */
+
+ public Image getToolTipImage(Object object);
+
+ /**
+ * @see CellLabelProvider
+ *
+ *
+ * @param element
+ * the element for which the tool tip is shown
+ * @return the {@link String} or <code>null</code> if there is not text to
+ * display
+ */
+ public String getToolTipText(Object element);
+
+ /**
+ * Return the amount of pixels in x and y direction you want the tool tip to
+ * pop up from the mouse pointer. The default shift is 10px right and 0px
+ * below your mouse cursor. Be aware of the fact that you should at least
+ * position the tool tip 1px right to your mouse cursor else click events
+ * may not get propagated properly.
+ *
+ * @param object
+ * the element for which the tool tip is shown
+ * @return {@link Point} to shift of the tool tip or <code>null</code> if the
+ * default shift should be used.
+ */
+ public Point getToolTipShift(Object object);
+
+ /**
+ * The time in milliseconds the tool tip is shown for.
+ *
+ * @param object
+ * the {@link Object} for which the tool tip is shown
+ * @return time in milliseconds the tool tip is shown for
+ */
+ public int getToolTipTimeDisplayed(Object object);
+
+ /**
+ * The time in milliseconds until the tool tip is displayed.
+ *
+ * @param object
+ * the {@link Object} for which the tool tip is shown
+ * @return time in milliseconds until the tool tip is displayed
+ */
+ public int getToolTipDisplayDelayTime(Object object);
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/LinkHelper.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/LinkHelper.java
new file mode 100644
index 00000000000..30087a972a8
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/LinkHelper.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.core.ui.IRevealSemanticElement;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.navigator.ILinkHelper;
+/**
+ * This class is to link form the model explorer to diagram
+ * This code was to not put in the model explorer in order to avoid dependences with gmf in the more abstract explorer
+ *
+ */
+
+public class LinkHelper implements ILinkHelper {
+ /**
+ *
+ * @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput)
+ *
+ */
+ public IStructuredSelection findSelection(IEditorInput anInput) {
+ return null;
+ }
+ /**
+ *
+ * @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection)
+ *
+ */
+ public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
+ //no selection
+ if (aSelection == null || aSelection.isEmpty())
+ return;
+
+ IMultiDiagramEditor papyrusEditor=EditorUtils.getMultiDiagramEditor();
+
+ IEditorPart diagramEditor= papyrusEditor.getActiveEditor();
+
+ if (diagramEditor instanceof IRevealSemanticElement){
+ if( aSelection instanceof IStructuredSelection){
+ Iterator<?> selectionIterator=((IStructuredSelection)aSelection).iterator();
+ ArrayList semanticElementList= new ArrayList();
+ while(selectionIterator.hasNext()) {
+ Object currentSelection = (Object)selectionIterator.next();
+ if( currentSelection instanceof IAdaptable){
+ Object semanticElement=((IAdaptable)currentSelection).getAdapter(EObject.class);
+ if( semanticElement!=null){
+ semanticElementList.add(semanticElement);
+ }
+ }
+
+ }
+ ((IRevealSemanticElement)diagramEditor).revealSemanticElement(semanticElementList);
+ }
+ }
+
+ }
+
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProvider.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProvider.java
index 690060590bb..7be355297ac 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProvider.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProvider.java
@@ -14,38 +14,158 @@
*****************************************************************************/
package org.eclipse.papyrus.modelexplorer;
+import org.apache.commons.lang.WordUtils;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelLabelProvider;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.papyrus.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.core.editorsfactory.PageIconsRegistry;
import org.eclipse.papyrus.core.services.ServiceException;
import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.modelexplorer.validation.ValidationTool;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
/**
* the label provider that inherits of modisco label provider
*
*/
public class MoDiscoLabelProvider extends CustomizableModelLabelProvider {
-
+
private IPageIconsRegistry editorRegistry;
public MoDiscoLabelProvider() {
super(Activator.getDefault().getCustomizationManager());
}
- // A virer
+
+ public String getMarkerMessage(Object element) {
+
+ ValidationTool vt = new ValidationTool (element);
+ IMarker markers[] = vt.getMarkers();
+ if (markers != null) {
+ boolean examineChilds = true;
+ String message = "";
+ for (IMarker marker : markers) {
+ EObject eObjectOfMarker = vt.eObjectOfMarker(marker);
+ if (eObjectOfMarker == vt.getEObject()) {
+ if (message.length() > 0) {
+ message += "\n";
+ }
+ // vt.getWrappedMessage (marker);
+ try {
+ message += "- " + WordUtils.wrap ((String) marker.getAttribute(IMarker.MESSAGE), 100, "\n ", true);
+ }
+ catch (CoreException e) {
+ }
+ }
+ if (examineChilds && (eObjectOfMarker != null)) {
+ eObjectOfMarker = eObjectOfMarker.eContainer();
+ while (eObjectOfMarker != null) {
+ if (eObjectOfMarker == vt.getEObject ()) {
+ if (message.length() > 0) {
+ message += "\n";
+ }
+ message += "- Problem marker in (at least) one of the children";
+ examineChilds = false;
+ break;
+ }
+ // navigate to parents, since parent folder is contaminated as well
+ eObjectOfMarker = eObjectOfMarker.eContainer();
+ }
+ }
+ }
+ return (message.length() > 0) ? message : null;
+ }
+ return null;
+ }
+
+ // A virer (??)
+ @Override
+ /**
+ * return the image of an element in the model browser
+ * evaluates error markers.
+ */
public Image getImage(Object element) {
+
+ ValidationTool vt = new ValidationTool (element);
+ vt.tryChildIfEmpty();
+ int severity = 0;
+ IMarker markers[] = vt.getMarkers();
+ if (markers != null) {
+ for (IMarker marker : markers) {
+ EObject eObjectOfMarker = vt.eObjectOfMarker(marker);
+ while (eObjectOfMarker != null) {
+ if (eObjectOfMarker == vt.getEObject()) {
+ try {
+ Integer severityI = (Integer) marker.getAttribute(IMarker.SEVERITY);
+ if (severityI.intValue () > severity) {
+ severity = severityI.intValue();
+ }
+ }
+ catch (CoreException e) {
+ }
+ }
+ // navigate to parents, since parent folder is contaminated as well
+ eObjectOfMarker = eObjectOfMarker.eContainer();
+ }
+ }
+ }
if(element instanceof Diagram) {
- return getEditorRegistry().getEditorIcon(element);
+ return getDecoratedImage (getEditorRegistry().getEditorIcon(element), severity);
}
- return super.getImage(element);
+
+ return getDecoratedImage (super.getImage(element), severity);
}
/**
+ * Return a DecoratedImage, thanks to Torkild U. Resheim (Trondheim, Norway)
+ * @param registry
+ * @param baseImageId
+ * @param status
+ * @return
+ */
+ private Image getDecoratedImage(Image baseImage, int severity) {
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+ ImageDescriptor overlay = null;
+ switch (severity) {
+ case IMarker.SEVERITY_ERROR:
+ overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
+ break;
+ case IMarker.SEVERITY_WARNING:
+ overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING);
+ break;
+ default:
+ return baseImage;
+ }
+ // Construct a new image identifier
+ String decoratedImageId = baseImage.toString().concat(String.valueOf(severity));
+ // Return the stored image if we have one
+ if (registry.get(decoratedImageId) == null) {
+ // Otherwise create a new image and store it
+ DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(
+ baseImage, new ImageDescriptor[] { null, null, null,
+ overlay, null }, size16) {
+ };
+ registry.put(decoratedImageId, decoratedImage);
+ }
+ return registry.get(decoratedImageId);
+ }
+
+ private static final Point size16 = new Point (16, 16);
+
+ private static final ImageRegistry registry = new ImageRegistry ();
+
+ /**
* Get the EditorRegistry used to create editor instances. This default
* implementation return the singleton eINSTANCE. This method can be
* subclassed to return another registry.
@@ -81,6 +201,7 @@ public class MoDiscoLabelProvider extends CustomizableModelLabelProvider {
/**
* @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelLabelProvider#getText(java.lang.Object)
*/
+ @Override
public String getText(Object element) {
String text = null;
if(element instanceof Diagram) {
@@ -98,5 +219,5 @@ public class MoDiscoLabelProvider extends CustomizableModelLabelProvider {
text = super.getText(element);
}
return text;
- }
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProviderWTooltips.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProviderWTooltips.java
new file mode 100644
index 00000000000..1f84386793a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/MoDiscoLabelProviderWTooltips.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * the label provider that inherits of modisco label provider
+ *
+ */
+public class MoDiscoLabelProviderWTooltips extends ColumnLabelProvider {
+
+ private MoDiscoLabelProvider moDiscoLP;
+
+ public MoDiscoLabelProviderWTooltips() {
+ moDiscoLP = new MoDiscoLabelProvider ();
+ }
+
+ @Override
+ public String getToolTipText(Object element) {
+ return moDiscoLP.getMarkerMessage(element);
+ }
+
+ @Override
+ public Point getToolTipShift(Object object) {
+ return new Point(5, 5);
+ }
+
+ @Override
+ public int getToolTipDisplayDelayTime(Object object) {
+ return 1000;
+ }
+
+ @Override
+ public int getToolTipTimeDisplayed(Object object) {
+ return 10000;
+ }
+
+ /**
+ * return the image of an element in the model browser
+ * evaluates error markers.
+ */
+ @Override
+ public Image getImage(Object element) {
+ return moDiscoLP.getImage(element);
+ }
+
+ /**
+ * @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelLabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ return moDiscoLP.getText(element);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPage.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPage.java
index 21b03778912..c81c1988981 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPage.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPage.java
@@ -61,7 +61,7 @@ public class ModelExplorerPage extends ViewPartPage {
}
/**
- * Retun the control
+ * Return the control
*
* @see org.eclipse.papyrus.core.ui.pagebookview.ViewPartPage#getControl()
*
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPageBookView.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPageBookView.java
index 5fdf690379e..dba4417b9a0 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPageBookView.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerPageBookView.java
@@ -9,14 +9,33 @@
*
* Contributors:
* Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Added support for IGotoMarker
*
*****************************************************************************/
package org.eclipse.papyrus.modelexplorer;
+import static org.eclipse.papyrus.core.Activator.log;
+
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.papyrus.core.ui.pagebookview.MultiViewPageBookView;
import org.eclipse.papyrus.core.ui.pagebookview.ViewPartPage;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -28,7 +47,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* @author cedric dumoulin
*
*/
-public class ModelExplorerPageBookView extends MultiViewPageBookView implements ITabbedPropertySheetPageContributor {
+public class ModelExplorerPageBookView extends MultiViewPageBookView implements IGotoMarker, ITabbedPropertySheetPageContributor {
/**
* Create the page handling the View for the specified part.
@@ -84,5 +103,73 @@ public class ModelExplorerPageBookView extends MultiViewPageBookView implements
}
-
+ /**
+ * Find an Element within the tree (a ModelElementItem) when given an EObject
+ *
+ * @param eObjectToFind
+ * @param treeViewer
+ * @return
+ */
+ public Object findElementForEObject(TreeViewer treeViewer, EObject eObjectToFind) {
+ ITreeContentProvider contentProvider = (ITreeContentProvider) treeViewer.getContentProvider();
+ Object[] elements = contentProvider.getElements(treeViewer.getInput());
+
+ LinkedList<Object> elementsToHandle = new LinkedList<Object>();
+ for (Object element : elements) {
+ elementsToHandle.add(element);
+ }
+ while (!elementsToHandle.isEmpty()) {
+ Object e = elementsToHandle.removeFirst();
+ EObject eObject = (EObject) Platform.getAdapterManager().getAdapter(e, EObject.class);
+ if (eObject != null && eObject.equals(eObjectToFind)) {
+ return e;
+ }
+ if (contentProvider.hasChildren(e)) {
+ Object[] children = contentProvider.getChildren(e);
+ if (children != null) {
+ for (Object child : children) {
+ elementsToHandle.addLast(child);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public void gotoMarker(IMarker marker) {
+ try {
+ if (marker.isSubtypeOf((EValidator.MARKER))) {
+ String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ if(uriAttribute != null) {
+ URI uri = URI.createURI(uriAttribute);
+ IViewPart viewPart = getActiveView();
+ if (viewPart instanceof ModelExplorerView) {
+ ModelExplorerView modelExplorerView = (ModelExplorerView) viewPart;
+ EditingDomain domain = modelExplorerView.getEditingDomain();
+ EObject eObject = domain.getResourceSet().getEObject(uri, true);
+ if (eObject != null) {
+ CommonViewer treeViewer = ((ModelExplorerView) viewPart).getCommonViewer();
+ // The common viewer is in fact a tree viewer
+ Object modelElementItem = findElementForEObject (treeViewer, eObject);
+ if (modelElementItem != null) {
+ TreePath treePath = new TreePath(new Object[] {
+ modelElementItem
+ });
+ EObject parent = eObject.eContainer();
+ if (parent != null) {
+ // workaround: in case of a pseudo parent (like "ownedConnector", the expansion
+ // is not made automatically
+ Object parentElement = findElementForEObject (treeViewer, parent);
+ treeViewer.expandToLevel(parentElement, 1);
+ }
+ treeViewer.setSelection(new TreeSelection (treePath), true);
+ }
+ }
+ }
+ }
+ }
+ } catch (CoreException exception) {
+ log.error(exception);
+ }
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerView.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerView.java
index 120fd5fca87..6f5f27fc391 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerView.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/ModelExplorerView.java
@@ -13,33 +13,58 @@
*****************************************************************************/
package org.eclipse.papyrus.modelexplorer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.ResourceSetListenerImpl;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.ToolTip;
import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.lifecycleevents.IEditorInputChangedListener;
import org.eclipse.papyrus.core.lifecycleevents.ISaveAndDirtyService;
-import org.eclipse.papyrus.core.lifecycleevents.SaveAndDirtyService;
import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.ui.IRevealSemanticElement;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.core.utils.ServiceUtils;
+import org.eclipse.papyrus.modelexplorer.listener.DoubleClickListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.ISaveablePart;
+import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.internal.navigator.NavigatorContentService;
+import org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor;
import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.operations.RedoActionHandler;
import org.eclipse.ui.operations.UndoActionHandler;
import org.eclipse.ui.part.FileEditorInput;
@@ -53,7 +78,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* source when the current Editor change. To allow to explore different Model, use a {@link ModelExplorerPageBookView}.
*
*/
-public class ModelExplorerView extends CommonNavigator {
+public class ModelExplorerView extends CommonNavigator implements IRevealSemanticElement{
/**
* The associated EditorPart
@@ -64,7 +89,7 @@ public class ModelExplorerView extends CommonNavigator {
* The save aservice associated to the editor.
*/
private ISaveAndDirtyService saveAndDirtyService;
-
+
private TransactionalEditingDomain editingDomain;
/**
@@ -96,7 +121,7 @@ public class ModelExplorerView extends CommonNavigator {
firePropertyChange(IEditorPart.PROP_DIRTY);
}
};
-
+
/**
* Undo action handler
@@ -123,13 +148,145 @@ public class ModelExplorerView extends CommonNavigator {
*/
public ModelExplorerView(IMultiDiagramEditor part) {
this.editorPart = part;
+ setLinkingEnabled(true);
try {
this.saveAndDirtyService =editorPart.getServicesRegistry().getService(ISaveAndDirtyService.class);
} catch (ServiceException e) {
e.printStackTrace();
}
}
+ /**
+ * Handle a selection change in the editor.
+ *
+ * @param part
+ * @param selection
+ */
+ private void handleSelectionChangedFromDiagramEditor(IWorkbenchPart part, ISelection selection) {
+ // Handle selection from diagram editor
+ if(isLinkingEnabled() ) {
+ if(part instanceof IEditorPart) {
+ if( selection instanceof IStructuredSelection){
+ Iterator<?> selectionIterator=((IStructuredSelection)selection).iterator();
+ ArrayList semanticElementList= new ArrayList();
+ while(selectionIterator.hasNext()) {
+ Object currentSelection = (Object)selectionIterator.next();
+ if( currentSelection instanceof IAdaptable){
+ Object semanticElement=((IAdaptable)currentSelection).getAdapter(EObject.class);
+ if( semanticElement!=null){
+ semanticElementList.add(semanticElement);
+ }
+ }
+
+ }
+ revealSemanticElement(semanticElementList);
+
+ }
+
+ }
+ }
+ }
+
+ /**
+ * look for the path the list of element (comes from the content provider) to go the eObject
+ * @param eobject that we look for.
+ * @param objects a list of elements where eobject can be wrapped.
+ * @return the list of modelElementItem ( from the root to the element that wrap the eobject)
+ */
+ protected List<Object> searchPath(EObject eobject, List<Object> objects) {
+ SemanticFromModelExplorer semanticGetter= new SemanticFromModelExplorer();
+ List<Object> path = new ArrayList<Object>();
+ ITreeContentProvider contentProvider=(ITreeContentProvider)getCommonViewer().getContentProvider();
+
+ for(Object o : objects) {
+ // Search matches in this level
+ if(!(o instanceof Diagram) && o instanceof IAdaptable) {
+ if(eobject.equals((EObject)((IAdaptable)o).getAdapter(EObject.class))){
+ path.add(o);
+ return path;
+ }
+ }
+
+ // Find childs only for feature container
+ for(int i = 0; i < contentProvider.getChildren(o).length; i++) {
+ Object treeItem=contentProvider.getChildren(o)[i];
+
+ List<Object> tmppath=new ArrayList<Object>();
+ //can be change into IADAPTER by using new API of modisco
+ Object element=semanticGetter.getSemanticElement(treeItem);
+ if(element !=null){
+ if(element instanceof EReference){
+ if (((EReference)element).isContainment()&& (!((EReference)element).isDerived())){
+ List<Object> childs = new ArrayList<Object>();
+ childs.add(treeItem);
+ tmppath=searchPath(eobject, childs);
+ }
+ }
+
+ else{
+ if(element instanceof EObject) {
+ List<Object> childs = new ArrayList<Object>();
+ childs.add(treeItem);
+ tmppath=searchPath(eobject, childs);
+ }
+ }
+ }
+
+ // if tmppath contains the wrapped eobject we have find the good path
+ if(tmppath.size()>0){
+ if( tmppath.get(tmppath.size()-1) instanceof IAdaptable){
+ if(eobject.equals((EObject)((IAdaptable)(tmppath.get(tmppath.size()-1))).getAdapter(EObject.class))){
+ path.add(o);
+ path.addAll(tmppath);
+ return path;
+ }
+ }
+ }
+ }
+ }
+
+ return new ArrayList<Object>();
+ }
+
+ // Use of internal class (NavigatorContentService) - in the hope that the bug gets fixed soon.
+ @SuppressWarnings("restriction")
+ protected CommonViewer createCommonViewerObject(Composite aParent) {
+ CommonViewer viewer = new CustomCommonViewer(getViewSite().getId(), aParent,
+ SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ // enable tool-tips
+ // workaround for bug 311827: the Common Viewer always uses NavigatorDecoratingLabelProvider
+ // as a wrapper for the LabelProvider provided by the application. The NavigatorDecoratingLabelProvider
+ // does not delegate tooltip related functions but defines them as empty.
+ NavigatorContentService contentService = new NavigatorContentService(getViewSite().getId());
+ @SuppressWarnings("unchecked")
+ // get label provider from content service (which in turn evaluates extension points in
+ // function of the input)
+ Set<Object> descriptors = contentService.findDescriptorsByTriggerPoint(getInitialInput(), false);
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof NavigatorContentDescriptor) {
+ try {
+ ILabelProvider labelProvider = ((NavigatorContentDescriptor) descriptor).createLabelProvider();
+ viewer.setLabelProvider(labelProvider);
+ }
+ catch (CoreException e) {
+ System.err.println(e);
+ }
+ break;
+ }
+ }
+ ColumnViewerToolTipSupport.enableFor(viewer,ToolTip.NO_RECREATE);
+ return viewer;
+ }
+ @Override
+ public void createPartControl(Composite aParent) {
+ // TODO Auto-generated method stub
+ super.createPartControl(aParent);
+ getCommonViewer().setSorter(null);
+ ((CustomCommonViewer)getCommonViewer()).getDropAdapter().setFeedbackEnabled(true);
+
+ getCommonViewer().addDoubleClickListener(new DoubleClickListener());
+
+ }
/**
* Return the control used to render this View
*
@@ -154,6 +311,16 @@ public class ModelExplorerView extends CommonNavigator {
}
+ public void init(IViewSite site) throws PartInitException {
+ super.init(site);
+ IWorkbenchPage page = site.getPage();
+ // an ISelectionListener to react to workbench selection changes.
+
+ page.addSelectionListener(new ISelectionListener() {
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ handleSelectionChangedFromDiagramEditor(part, selection);
+ }});
+ }
/**
* Hook the global undo/redi actions.
*/
@@ -200,8 +367,9 @@ public class ModelExplorerView extends CommonNavigator {
* refresh the view.
*/
public void refresh() {
- // Skip if control is disposed or not visible
- if(getControl().isDisposed() || !getControl().isVisible())
+ // Need to refresh, even if (temporarily) invisible
+ // (Better alternative?: store refresh event and execute once visible again)
+ if (getControl().isDisposed())
return;
// avoid reentrant call
@@ -239,10 +407,10 @@ public class ModelExplorerView extends CommonNavigator {
private void activate() {
if(editorPart != null) {
-
+
try {
this.editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(editorPart.getServicesRegistry());
-// this.editingDomain = EditorUtils.getTransactionalEditingDomain(editorPart.getServicesRegistry());
+ // this.editingDomain = EditorUtils.getTransactionalEditingDomain(editorPart.getServicesRegistry());
// Set Viewer input if it already exist
if(getCommonViewer() != null) {
getCommonViewer().setInput(editorPart.getServicesRegistry());
@@ -254,7 +422,7 @@ public class ModelExplorerView extends CommonNavigator {
// Listen to isDirty flag
saveAndDirtyService.addInputChangedListener(editorInputChangedListener);
-
+
// Hook
// if(undoHandler != null){
// IUndoContext undoContext = getUndoContext(part);
@@ -288,8 +456,8 @@ public class ModelExplorerView extends CommonNavigator {
// deactivate global handler
if(editorPart != null) {
- Activator.log.debug("deactivate " + editorPart.getTitle());
-
+ Activator.log.debug("deactivate " + editorPart.getTitle());
+
// Stop Listenning to isDirty flag
saveAndDirtyService.removeInputChangedListener(editorInputChangedListener);
@@ -352,12 +520,12 @@ public class ModelExplorerView extends CommonNavigator {
// Let the parent return the adapter.
}
-
+
if( ISaveablePart.class.equals(adapter)) {
-
+
return saveAndDirtyService;
}
-
+
return super.getAdapter(adapter);
}
@@ -378,9 +546,64 @@ public class ModelExplorerView extends CommonNavigator {
*/
public void selectReveal(ISelection selection) {
if(getCommonViewer() != null) {
+
getCommonViewer().setSelection(selection, true);
}
}
-}
+ public void expandItems(List<Object> treeElementList, TreeItem[] list){
+ //the treeElement has more tan one element
+ if(treeElementList.size()>0){
+ for(int i=0;i<list.length;i++) {
+ if(list[i].getData()!=null && list[i].getData().equals(treeElementList.get(0))){
+ if(treeElementList.size()>1){//Do no expand the last
+ Object[] toexpand={treeElementList.get(0)};
+ getCommonViewer().setExpandedElements(toexpand);
+ }
+ ArrayList<Object> tmpList= new ArrayList<Object>();
+ tmpList.addAll(treeElementList);
+ tmpList.remove(tmpList.get(0));
+ expandItems(tmpList, list[i].getItems());
+ }
+
+ }
+
+ }
+
+ }
+ /**
+ * reveal all tree element that represent a semantic element in the given list.
+
+
+ * @see org.eclipse.papyrus.core.ui.IRevealSemanticElement#revealSemanticElement(java.util.List)
+ *
+ */
+ public void revealSemanticElement(List<?> elementList) {
+ //for each element we reveal it
+ Iterator<?> elementListIterator= elementList.iterator();
+ while(elementListIterator.hasNext()) {
+ Object currentElement = (Object)elementListIterator.next();
+ //test if the type is an EObject
+ if(currentElement instanceof EObject){
+ EObject currentEObject=(EObject)currentElement;
+ //the content provider exist?
+ if(getCommonViewer().getContentProvider()!=null){
+ //need the root in order to find all element in the tree
+ Object root=getCommonViewer().getInput();
+ //look for the path in order to access to this element
+ List<Object> path =searchPath(currentEObject, Arrays.asList(((ITreeContentProvider)getCommonViewer().getContentProvider()).getElements(root)));
+ if(path.size()>0){
+ //expand in the common viewer the path
+ expandItems(path, getCommonViewer().getTree().getItems());
+ selectReveal(new StructuredSelection(path.get(path.size()-1)));
+
+ }
+
+ }
+ }
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/SemanticFromModelExplorer.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/SemanticFromModelExplorer.java
new file mode 100644
index 00000000000..53b7385918f
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/SemanticFromModelExplorer.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.LinkItem;
+import org.eclipse.papyrus.core.IElementWithSemantic;
+
+/**
+ * this class is used to obtain the semantic element for element of the model explorer
+ *
+ */
+public class SemanticFromModelExplorer implements IElementWithSemantic {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.IElementWithSemantic#getSemanticElement(java.lang.Object)
+ *
+ * @param wrapper can be for example ModelElementItem of LinkItem
+ * @return the semantic element linked to this.
+ */
+ public Object getSemanticElement(Object wrapper) {
+ if( wrapper instanceof IAdaptable){
+ return ((IAdaptable)wrapper).getAdapter(EObject.class);
+ }
+
+ //In the next version of modisco LinkItem will become a IAdaptable
+ if( wrapper instanceof LinkItem){
+ return ((LinkItem)wrapper).getReference();
+ }
+ if( wrapper instanceof Diagram){
+ return wrapper;
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateChildActionProvider.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateChildActionProvider.java
index b6077b9b732..fcdecd436a2 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateChildActionProvider.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateChildActionProvider.java
@@ -31,6 +31,7 @@ import org.eclipse.ui.navigator.ICommonActionExtensionSite;
/**
* The Class CreateChildActions.
*
+ * @deprecated
* @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
*/
public class CreateChildActionProvider extends AbstractSubmenuActionProvider {
@@ -59,23 +60,17 @@ public class CreateChildActionProvider extends AbstractSubmenuActionProvider {
ISelection selection = getContext().getSelection();
Collection<?> newChildDescriptors = null;
Object selectedElement = null;
- if (selection instanceof IStructuredSelection
- && ((IStructuredSelection) selection).size() == 1) {
- selectedElement = resolveSemanticObject(((IStructuredSelection) selection)
- .getFirstElement());
- TransactionalEditingDomain domain = EditorUtils
- .getTransactionalEditingDomain();
- if (domain == null) {
+ if(selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ selectedElement = resolveSemanticObject(((IStructuredSelection)selection).getFirstElement());
+ TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ if(domain == null) {
return;
}
- newChildDescriptors = domain.getNewChildDescriptors(
- selectedElement, null);
+ newChildDescriptors = domain.getNewChildDescriptors(selectedElement, null);
}
- createChildActions = generateCreateChildActions(newChildDescriptors,
- selection);
- createChildSubmenuActions = extractSubmenuActions(createChildActions,
- "|");
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createChildSubmenuActions = extractSubmenuActions(createChildActions, "|");
MenuManager submenuManager = new MenuManager("New Child");
populateManager(submenuManager, createChildSubmenuActions, null);
populateManager(submenuManager, createChildActions, null);
@@ -86,24 +81,21 @@ public class CreateChildActionProvider extends AbstractSubmenuActionProvider {
* Generate create child actions.
*
* @param descriptors
- * the descriptors
+ * the descriptors
* @param selection
- * the selection
+ * the selection
*
* @return the collection< i action>
*/
- protected Collection<IAction> generateCreateChildActions(
- Collection<?> descriptors, ISelection selection) {
- List<IAction> createChildActions = (List<IAction>) generateCreateChildActionsGen(
- descriptors, selection);
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
+ List<IAction> createChildActions = (List<IAction>)generateCreateChildActionsGen(descriptors, selection);
- Collections.<IAction> sort(createChildActions,
- new Comparator<IAction>() {
+ Collections.<IAction> sort(createChildActions, new Comparator<IAction>() {
- public int compare(IAction a1, IAction a2) {
- return a1.getText().compareTo(a2.getText());
- }
- });
+ public int compare(IAction a1, IAction a2) {
+ return a1.getText().compareTo(a2.getText());
+ }
+ });
return createChildActions;
}
@@ -112,21 +104,18 @@ public class CreateChildActionProvider extends AbstractSubmenuActionProvider {
* Generate create child actions gen.
*
* @param descriptors
- * the descriptors
+ * the descriptors
* @param selection
- * the selection
+ * the selection
*
* @return the collection< i action>
*/
- protected Collection<IAction> generateCreateChildActionsGen(
- Collection<?> descriptors, ISelection selection) {
+ protected Collection<IAction> generateCreateChildActionsGen(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
- if (descriptors != null) {
- for (Object descriptor : descriptors) {
- if (descriptor instanceof CommandParameter) {
- actions.add(new CreateChildAction(EditorUtils
- .getTransactionalEditingDomain(), selection,
- descriptor));
+ if(descriptors != null) {
+ for(Object descriptor : descriptors) {
+ if(descriptor instanceof CommandParameter) {
+ actions.add(new CreateChildAction(EditorUtils.getTransactionalEditingDomain(), selection, descriptor));
}
}
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateDiagramActionProvider.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateDiagramActionProvider.java
index 55bd0c40cbf..48dd57982cc 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateDiagramActionProvider.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actionprovider/CreateDiagramActionProvider.java
@@ -22,6 +22,7 @@ import org.eclipse.papyrus.modelexplorer.actions.CreateDiagramAction;
/**
* Provider used to create a new diagram actions
*
+ * @deprecated
*/
public class CreateDiagramActionProvider extends AbstractSubmenuActionProvider {
@@ -34,16 +35,13 @@ public class CreateDiagramActionProvider extends AbstractSubmenuActionProvider {
public void fillContextMenu(IMenuManager menu) {
Object selectedElement = resolveSemanticObject(getFirstSelectedElement());
- if (selectedElement != null && selectedElement instanceof EObject) {
- EObject eobject = (EObject) selectedElement;
+ if(selectedElement != null && selectedElement instanceof EObject) {
+ EObject eobject = (EObject)selectedElement;
MenuManager newDiagramMenu = new MenuManager("New Diagram");
menu.add(newDiagramMenu);
- for (CreationCommandDescriptor desc : getCreationCommandRegistry()
- .getCommandDescriptors()) {
- if (desc.getCondition() == null
- || desc.getCondition().create(eobject)) {
- CreateDiagramAction createDiagramAction = new CreateDiagramAction(
- eobject, desc);
+ for(CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
+ if(desc.getCondition() == null || desc.getCondition().create(eobject)) {
+ CreateDiagramAction createDiagramAction = new CreateDiagramAction(eobject, desc);
newDiagramMenu.add(createDiagramAction);
}
}
@@ -51,9 +49,8 @@ public class CreateDiagramActionProvider extends AbstractSubmenuActionProvider {
}
private ICreationCommandRegistry getCreationCommandRegistry() {
- if (creationCommandRegistry == null) {
- this.creationCommandRegistry = new CreationCommandRegistry(
- org.eclipse.papyrus.core.Activator.PLUGIN_ID);
+ if(creationCommandRegistry == null) {
+ this.creationCommandRegistry = new CreationCommandRegistry(org.eclipse.papyrus.core.Activator.PLUGIN_ID);
}
return creationCommandRegistry;
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/CreateDiagramAction.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/CreateDiagramAction.java
index 11b6e1c5630..f9ced820c75 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/CreateDiagramAction.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/CreateDiagramAction.java
@@ -25,6 +25,7 @@ import org.eclipse.papyrus.core.utils.EditorUtils;
* Action used to create a new diagram for given type modified to remove link
* toUML
*
+ * @deprecated
*/
public class CreateDiagramAction extends Action {
@@ -38,10 +39,9 @@ public class CreateDiagramAction extends Action {
* Constructor
*
* @param selectedObject
- * the selected Element on which the diagram is to be associated
+ * the selected Element on which the diagram is to be associated
*/
- public CreateDiagramAction(EObject eObject,
- CreationCommandDescriptor commandDescriptor) {
+ public CreateDiagramAction(EObject eObject, CreationCommandDescriptor commandDescriptor) {
this.container = eObject;
this.commandDescriptor = commandDescriptor;
setText(commandDescriptor.getLabel());
@@ -66,29 +66,26 @@ public class CreateDiagramAction extends Action {
public void run() {
// Start LOG
- if (log.isDebugEnabled()) {
+ if(log.isDebugEnabled()) {
log.debug("Start - CreateDiagramAction#run"); //$NON-NLS-1$
}
try {
- ICreationCommand creationCommand = getCreationCommandRegistry()
- .getCommand(commandDescriptor.getCommandId());
- creationCommand.createDiagram(EditorUtils.getDiResourceSet(),
- container, null);
+ ICreationCommand creationCommand = getCreationCommandRegistry().getCommand(commandDescriptor.getCommandId());
+ creationCommand.createDiagram(EditorUtils.getDiResourceSet(), container, null);
} catch (NotFoundException e) {
log.error(e);
}
// END LOG
- if (log.isDebugEnabled()) {
+ if(log.isDebugEnabled()) {
log.debug("End - CreateDiagramAction#run"); //$NON-NLS-1$
}
}
private ICreationCommandRegistry getCreationCommandRegistry() {
- if (creationCommandRegistry == null) {
- this.creationCommandRegistry = new CreationCommandRegistry(
- org.eclipse.papyrus.core.Activator.PLUGIN_ID);
+ if(creationCommandRegistry == null) {
+ this.creationCommandRegistry = new CreationCommandRegistry(org.eclipse.papyrus.core.Activator.PLUGIN_ID);
}
return creationCommandRegistry;
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/GenericTransformer.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/GenericTransformer.java
index eb134660fd9..4d510fdbf94 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/GenericTransformer.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/GenericTransformer.java
@@ -68,6 +68,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.core.utils.PapyrusEcoreUtils;
import org.eclipse.papyrus.modelexplorer.Activator;
import org.eclipse.papyrus.modelexplorer.commands.EObjectInheritanceCopyCommand;
import org.eclipse.swt.widgets.Display;
@@ -454,8 +455,7 @@ public class GenericTransformer {
MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, 0,
"Type incompatibility", null);
if (element != null) {
- Collection<Setting> usages = EObjectInheritanceCopyCommand
- .getUsages(element);
+ Collection<Setting> usages = PapyrusEcoreUtils.getUsages(element);
if (usages != null) {
for (EStructuralFeature.Setting nonNavigableInverseReference : usages) {
EStructuralFeature structuralFeature = nonNavigableInverseReference
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/PasteShapeOrElementAction.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/PasteShapeOrElementAction.java
new file mode 100644
index 00000000000..20137e686cc
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/PasteShapeOrElementAction.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.action.PasteAction;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element reprented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+public class PasteShapeOrElementAction extends PasteAction
+{
+ public PasteShapeOrElementAction (EditingDomain domain) {
+ super (domain);
+ }
+
+ @Override
+ public Command createCommand(Collection<?> selection)
+ {
+ if ((selection.size () == 1) && (domain != null)) {
+ Object owner = selection.iterator().next ();
+
+ boolean onlyViewsInClipboard = true;
+ boolean foundView = false;
+ if (domain.getClipboard () != null) {
+ for (Object clipObject : domain.getClipboard ()) {
+ if (clipObject instanceof View) {
+ foundView = true;
+ }
+ else {
+ onlyViewsInClipboard = false;
+ }
+ }
+ }
+ // TODO: currently only works for a single element to be copied.
+ if (onlyViewsInClipboard && foundView) {
+ View shape = (View) domain.getClipboard ().iterator ().next ();
+ return AddCommand.create (domain, owner, null, shape.getElement ());
+ }
+ }
+ return super.createCommand (selection);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/RenameDiagramAction.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/RenameDiagramAction.java
index b6a1ce3ebab..c216bb47147 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/RenameDiagramAction.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/actions/RenameDiagramAction.java
@@ -19,6 +19,7 @@ import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.modelexplorer.Activator;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
/**
@@ -35,6 +36,7 @@ public class RenameDiagramAction extends Action {
setImageDescriptor(Activator
.getImageDescriptor("icons/etool16/rename.gif"));
setText("Rename...");
+ setAccelerator(SWT.F2);
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/AbstractValidateCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/AbstractValidateCommand.java
new file mode 100644
index 00000000000..a18db6a40f5
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/AbstractValidateCommand.java
@@ -0,0 +1,199 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.commands;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.DiagnosticChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
+import org.eclipse.emf.edit.ui.action.ValidateAction.EclipseResourcesUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.modelexplorer.validation.ValidationTool;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element represented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+abstract public class AbstractValidateCommand extends AbstractTransactionalCommand {
+
+ protected EclipseResourcesUtil eclipseResourcesUtil =
+ EMFPlugin.IS_RESOURCES_BUNDLE_AVAILABLE ? new EclipseResourcesUtil() : null;
+
+ protected TransactionalEditingDomain domain;
+ protected EObject selectedElement;
+
+ /**
+ * Creates a new ImportLibraryFromRepositoryCommand
+ *
+ * @param editingDomain
+ * editing domain that manages the changed objects
+ * @param runnable
+ * process that executes the modifications
+ * @param label
+ * the label of the command
+ * @param description
+ * description of the command
+ */
+
+ public AbstractValidateCommand(String label, TransactionalEditingDomain domain, EObject selectedElement) {
+ super (domain, label, Collections.EMPTY_LIST);
+ this.domain = domain;
+ this.selectedElement = selectedElement;
+ }
+
+ protected void handleDiagnostic(Diagnostic diagnostic)
+ {
+ // Do not show a dialog, as in the original version since the user sees the result directly
+ // in the model explorer
+ Resource resource = getResource();
+ if (resource != null) {
+ if (selectedElement != null) {
+ ValidationTool vt = new ValidationTool(selectedElement);
+ vt.deleteSubMarkers();
+ }
+
+ // IPath path = new Path(resource.getURI().toPlatformString (false));
+ // IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ // IFile file = wsRoot.getFile(path);
+ // eclipseResourcesUtil.deleteMarkers (file);
+
+ for (Diagnostic childDiagnostic : diagnostic.getChildren()) {
+ eclipseResourcesUtil.createMarkers(resource, childDiagnostic);
+ // createMarkersOnDi (file, childDiagnostic);
+ }
+ }
+ }
+
+ protected Resource getResource() {
+ Resource resource = eclipseResourcesUtil != null ? domain.getResourceSet().getResources().get(0) : null;
+ return resource;
+ }
+
+ protected void runValidation (final EObject validateElement) {
+ final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ IRunnableWithProgress runnableWithProgress = new IRunnableWithProgress()
+ {
+ public void run(final IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException
+ {
+ try {
+ final Diagnostic diagnostic = validate(progressMonitor, validateElement);
+ shell.getDisplay().asyncExec (new Runnable() {
+ public void run()
+ {
+ if (progressMonitor.isCanceled()) {
+ handleDiagnostic(Diagnostic.CANCEL_INSTANCE);
+ }
+ else {
+ handleDiagnostic(diagnostic);
+ }
+ }
+ });
+ }
+ finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ if (eclipseResourcesUtil != null) {
+ runnableWithProgress = eclipseResourcesUtil.getWorkspaceModifyOperation(runnableWithProgress);
+ }
+
+ try {
+ // This runs the operation, and shows progress.
+ // (It appears to be a bad thing to fork this onto another thread.)
+ new ProgressMonitorDialog(shell).run(true, true, runnableWithProgress);
+ }
+ catch (Exception exception) {
+ EMFEditUIPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ /**
+ * This simply execute the command.
+ */
+ protected Diagnostic validate(IProgressMonitor progressMonitor, EObject validateElement)
+ {
+ int count = 0;
+ for (Iterator<?> i = validateElement.eAllContents(); i.hasNext(); i.next()) {
+ ++count;
+ }
+
+ progressMonitor.beginTask("", count);
+
+ AdapterFactory adapterFactory =
+ domain instanceof AdapterFactoryEditingDomain ? ((AdapterFactoryEditingDomain)domain).getAdapterFactory() : null;
+ Diagnostician diagnostician = createDiagnostician(adapterFactory, progressMonitor);
+
+ BasicDiagnostic diagnostic = diagnostician.createDefaultDiagnostic(validateElement);
+ Map<Object, Object> context = diagnostician.createDefaultContext();
+
+ progressMonitor.setTaskName(EMFEditUIPlugin.INSTANCE.getString("_UI_Validating_message", new Object [] {diagnostician.getObjectLabel(validateElement)}));
+ diagnostician.validate(validateElement, diagnostic, context);
+
+ return diagnostic;
+ }
+
+ protected Diagnostician createDiagnostician(final AdapterFactory adapterFactory, final IProgressMonitor progressMonitor)
+ {
+ return new Diagnostician() {
+ @Override
+ public String getObjectLabel(EObject eObject) {
+ if (adapterFactory != null && !eObject.eIsProxy())
+ {
+ IItemLabelProvider itemLabelProvider = (IItemLabelProvider)adapterFactory.adapt(eObject, IItemLabelProvider.class);
+ if (itemLabelProvider != null) {
+ return itemLabelProvider.getText(eObject);
+ }
+ }
+ return super.getObjectLabel(eObject);
+ }
+
+ @Override
+ public boolean validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ progressMonitor.worked(1);
+ return super.validate(eClass, eObject, diagnostics, context);
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canExecute() {
+ return (selectedElement != null);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/EObjectInheritanceCopyCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/EObjectInheritanceCopyCommand.java
index c8be210fcb1..832c12b0839 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/EObjectInheritanceCopyCommand.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/EObjectInheritanceCopyCommand.java
@@ -28,8 +28,6 @@ import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
@@ -38,6 +36,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.core.utils.PapyrusEcoreUtils;
/**
* The Class EObjectInheritanceCopyCommand. it takes an eobject in parameter and
@@ -247,7 +246,7 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand {
* the target eobject
*/
private void crossReference(EObject source, EObject target) {
- Collection<EStructuralFeature.Setting> collection = getUsages(source);
+ Collection<EStructuralFeature.Setting> collection = PapyrusEcoreUtils.getUsages(source);
if (collection != null) {
for (EStructuralFeature.Setting nonNavigableInverseReference : collection) {
EStructuralFeature structuralFeature = nonNavigableInverseReference
@@ -265,29 +264,6 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand {
}
/**
- * Gets the usages.
- *
- * @param source
- * the source
- *
- * @return the usages or null if there is no usages
- */
- public static Collection<EStructuralFeature.Setting> getUsages(
- EObject source) {
- Collection<EStructuralFeature.Setting> collection = null;
- ECrossReferenceAdapter crossReferenceAdapter = ECrossReferenceAdapter
- .getCrossReferenceAdapter(source);
- if (crossReferenceAdapter != null) {
- collection = crossReferenceAdapter
- .getNonNavigableInverseReferences(source);
- } else {
- collection = EcoreUtil.UsageCrossReferencer.find(source, source
- .eResource().getResourceSet());
- }
- return collection;
- }
-
- /**
* Checks if a type is compatible to another.
*
* @param type
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromModelCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromModelCommand.java
new file mode 100644
index 00000000000..5991af1fcef
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromModelCommand.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+
+
+public class ValidateDelMarkersFromModelCommand extends AbstractValidateCommand {
+
+ public ValidateDelMarkersFromModelCommand (EObject selectedElement) {
+ super ("Delete markers from model", TransactionUtil.getEditingDomain (selectedElement), selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Resource resource = getResource();
+ if ((resource != null) && (eclipseResourcesUtil != null)) {
+ eclipseResourcesUtil.deleteMarkers(getResource());
+ }
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromSubtreeCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromSubtreeCommand.java
new file mode 100644
index 00000000000..4b4146a1214
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateDelMarkersFromSubtreeCommand.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.papyrus.modelexplorer.validation.ValidationTool;
+
+
+public class ValidateDelMarkersFromSubtreeCommand extends AbstractValidateCommand {
+
+ public ValidateDelMarkersFromSubtreeCommand (EObject selectedElement) {
+ super ("Delete markers from subtree", TransactionUtil.getEditingDomain (selectedElement), selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ ValidationTool vt = new ValidationTool(selectedElement);
+ vt.deleteSubMarkers();
+
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateModelCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateModelCommand.java
new file mode 100644
index 00000000000..c1b9620cc04
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateModelCommand.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+
+
+public class ValidateModelCommand extends AbstractValidateCommand {
+
+ public ValidateModelCommand (EObject selectedElement) {
+ super ("Validate model", TransactionUtil.getEditingDomain (selectedElement), selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ EObject selectedObject = selectedElement;
+ // replace selection by model instead of current selection
+ while (selectedObject.eContainer() != null) {
+ selectedObject = selectedObject.eContainer ();
+ }
+ runValidation (selectedObject);
+
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateSubtreeCommand.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateSubtreeCommand.java
new file mode 100644
index 00000000000..c7bc33398b4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/commands/ValidateSubtreeCommand.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+
+
+public class ValidateSubtreeCommand extends AbstractValidateCommand {
+
+ public ValidateSubtreeCommand (EObject selectedElement) {
+ super ("Validate subtree", TransactionUtil.getEditingDomain (selectedElement), selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ runValidation (selectedElement);
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/dnd/CommonDropAdapterAssistant.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/dnd/CommonDropAdapterAssistant.java
index 0d4daa71bdb..353d342c7b9 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/dnd/CommonDropAdapterAssistant.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/dnd/CommonDropAdapterAssistant.java
@@ -29,11 +29,17 @@ import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.LinkItem;
+import org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.ModelElementItem;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.swt.dnd.DND;
@@ -49,39 +55,121 @@ import org.eclipse.ui.navigator.CommonDropAdapter;
public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonDropAdapterAssistant {
public CommonDropAdapterAssistant() {
-
}
@Override
public IStatus handleDrop(CommonDropAdapter dropAdapter,
- DropTargetEvent dropTargetEvent, Object dropTarget) {
+ DropTargetEvent dropTargetEvent, Object dropTarget) {
Object targetElement = (Object) dropTarget;
- if (org.eclipse.jface.util.LocalSelectionTransfer.getTransfer().isSupportedType(
- dropAdapter.getCurrentTransfer())) {
- switch (dropAdapter.getCurrentOperation()) {
- case DND.DROP_MOVE:
- execute(getDropCommand(targetElement));
- break;
- // case DND.DROP_COPY:
- // break;
+ execute(getDrop(targetElement));
+ return null;
+ }
+
+ /**
+ * get the list of command to put an eobject into another EObject,
+ * if the parameter eref is null,It will look for the good role of the child eobject
+ * @param domain the Transactional Domain , cannot be null
+ * @param targetOwner the eobject that will contain the drop object, cannot be null
+ * @param childElement that we want to move, cannot be null
+ * @param the EREFERENCE for the role of the child element, can be null
+ * @return the list of commands to to the drop
+ */
+ @SuppressWarnings("unchecked")
+ protected List<Command> getDropIntoCommand(TransactionalEditingDomain domain,EObject targetOwner, EObject childElement,EReference eref){
+ ArrayList<Command> commandList= new ArrayList<Command>();
+
+ //try to crete a command on for this reference
+ if(eref!=null){
+ ArrayList<EObject> tmp=new ArrayList<EObject>();
+ tmp.add(childElement);
+ if(targetOwner.eGet(eref) instanceof Collection<?>){
+ tmp.addAll((Collection<EObject>)targetOwner.eGet(eref));}
+ //to allow the undo, the creation of the remove command has to be explicit
+ Command emfCommand= RemoveCommand.create(domain, childElement);
+ emfCommand=emfCommand.chain(SetCommand.create(domain, targetOwner, eref, tmp));
+ commandList.add(emfCommand);
+
+ }
+
+ else{
+ //ref is null
+ ArrayList<EStructuralFeature> possibleEFeatures= new ArrayList<EStructuralFeature>();
+ EList<EStructuralFeature> featureList=targetOwner.eClass().getEAllStructuralFeatures();
+
+ //look for all possible feature betwen the owner and the child element
+ Iterator<EStructuralFeature> iterator= featureList.iterator();
+ while (iterator.hasNext()) {
+ EStructuralFeature eStructuralFeature = (EStructuralFeature) iterator.next();
+
+ if( eStructuralFeature instanceof EReference){
+ EReference ref= (EReference)eStructuralFeature;
+
+ if( ref.isContainment()){
+
+ if( isSubClass(ref.getEType(),childElement.eClass() )){
+ possibleEFeatures.add(eStructuralFeature);
+ }
+
+ }
+ }
}
+ //for each feature create a set command
+ Iterator<EStructuralFeature> iteratorFeature= possibleEFeatures.iterator();
+ while (iteratorFeature.hasNext()) {
+ EStructuralFeature eStructuralFeature = (EStructuralFeature) iteratorFeature
+ .next();
+ ArrayList<EObject> tmp=new ArrayList<EObject>();
+ tmp.add(childElement);
+ if(targetOwner.eGet(eStructuralFeature) instanceof Collection<?>){
+ tmp.addAll((Collection<EObject>)targetOwner.eGet(eStructuralFeature));
+ }
+ //to allow the undo, the creation of the remove command has to be explicit
+ Command emfCommand= RemoveCommand.create(domain, childElement);
+ emfCommand=emfCommand.chain( SetCommand.create(domain, targetOwner, eStructuralFeature, tmp));
+ commandList.add(emfCommand);
+ }
}
- return null;
+ return commandList;
}
-/**
- * get he list of command to put an eobject into another EObject
- * It will look for the good role of the child eobject
- * @param domain the Transactional Domain
- * @param targetOwner the eobject that will contain the drop object
- * @param childElement that we want to move
- * @return the list of commands to to teh drop
- */
- @SuppressWarnings("unchecked")
- protected List<Command> getDropCommand(TransactionalEditingDomain domain,EObject targetOwner, EObject childElement){
+
+ /**
+ * get a list that contains command to move a diagram into a new element
+ * @param domain the transactionnal edit domain, cannot be null
+ * @param targetOwner the target of the drop, cannot be null
+ * @param childElement the diagram that will move, cannot be null
+ * @return a list that contains one command to move the diagram
+ */
+ protected List<Command> getDropDiagramIntoCommand(TransactionalEditingDomain domain,EObject targetOwner, Diagram childElement){
+ ArrayList<Command> commandList= new ArrayList<Command>();
+ EReference eref= NotationPackage.eINSTANCE.getView_Element();
+ if(eref!=null){
+ ArrayList<EObject> tmp=new ArrayList<EObject>();
+ tmp.add(childElement);
+ if(targetOwner.eGet(eref) instanceof Collection<?>){
+ tmp.addAll((Collection<EObject>)targetOwner.eGet(eref));}
+
+ commandList.add( SetCommand.create(domain, childElement, eref, targetOwner));
+ }
+
+
+ return commandList;
+ }
+ /**
+ * get the list of command to put an eobject before or after another EObject
+ * It will look for the good role of the child eobject
+ * @param domain the Transactional Domain, cannot be null
+ * @param targetOwner the eobject that will contain the drop object , cannot be null
+ * @param objectLocation the object where we want to drop the object
+ * @param newElement that we want to move, cannot be null
+ * @return the list of commands to to the drop
+ */
+ protected List<Command> getOrderChangeCommand(TransactionalEditingDomain domain,EObject targetOwner,EObject objectLocation, EObject newElement, boolean before){
ArrayList<Command> commandList= new ArrayList<Command>();
ArrayList<EStructuralFeature> possibleEFeatures= new ArrayList<EStructuralFeature>();
EList<EStructuralFeature> featureList=targetOwner.eClass().getEAllStructuralFeatures();
+
+ //find the feature between childreen and owner
Iterator<EStructuralFeature> iterator= featureList.iterator();
while (iterator.hasNext()) {
EStructuralFeature eStructuralFeature = (EStructuralFeature) iterator.next();
@@ -91,21 +179,39 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
if( ref.isContainment()){
- if( isSubClass(ref.getEType(),childElement.eClass() )){
+ if( isSubClass(ref.getEType(),newElement.eClass() )){
possibleEFeatures.add(eStructuralFeature);
}
}
}
}
+
+ //create the command
Iterator<EStructuralFeature> iteratorFeature= possibleEFeatures.iterator();
while (iteratorFeature.hasNext()) {
EStructuralFeature eStructuralFeature = (EStructuralFeature) iteratorFeature
.next();
ArrayList<EObject> tmp=new ArrayList<EObject>();
- tmp.add(childElement);
if(targetOwner.eGet(eStructuralFeature) instanceof Collection<?>){
+ //get all element of this efeature
tmp.addAll((Collection<EObject>)targetOwner.eGet(eStructuralFeature));
+
+ if(!newElement.equals(objectLocation)){
+ tmp.remove(newElement);
+ //normally tmp.indexOf(objectLocation)!= -1
+ //if this the case objectlocation=new element and
+ //it has been removed
+ int indexObject=tmp.indexOf(objectLocation);
+ if( before&& indexObject!=-1){
+ tmp.add(tmp.indexOf(objectLocation), newElement);
+ }
+ else if( !before&& indexObject!=-1){
+ tmp.add(tmp.indexOf(objectLocation)+1, newElement);
+ }
+ }
+ }
+ else{tmp.add(newElement);
}
commandList.add( SetCommand.create(domain, targetOwner, eStructuralFeature, tmp));
@@ -113,9 +219,10 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
return commandList;
}
+
/**
* verify from a list of command if it can be dropped
- * @param commandList
+ * @param commandList, cannot be null but can be an empty list
*
* @return true or false
*/
@@ -144,12 +251,46 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
getEditingDomain().getCommandStack().execute(abstractCommand);
}
}
- }
+ }
+
/**
- * Testi if a possibleSub eclass is a sub eclass
- * @param aclass
- * @param possibleSubClasse
- * @return true if possible eclas is a subtype of a eclass or false
+ * get the list of good command by taking in account if this is a change order or a drop into
+ * @param target the target object of the drop
+ * @return the list of command
+ */
+ public List<Command> getDrop (Object target) {
+ CommonDropAdapter dropAdapter =getCommonDropAdapter();
+ List<Command> commandList=new ArrayList<Command>();
+ switch (dropAdapter.getCurrentOperation()) {
+ case DND.DROP_MOVE:
+ if(dropAdapter.getCurrentLocation()==ViewerDropAdapter.LOCATION_BEFORE){
+ if(target instanceof ModelElementItem){
+ commandList=getOrderChangeCommand(target, true);
+ }
+ }
+ else if(dropAdapter.getCurrentLocation()==ViewerDropAdapter.LOCATION_AFTER){
+ if(target instanceof ModelElementItem){
+ commandList=getOrderChangeCommand(target, false);
+ }
+ }
+ else if(dropAdapter.getCurrentLocation()==ViewerDropAdapter.LOCATION_ON){
+ if(target instanceof ModelElementItem){
+ commandList=getDropIntoCommand(target, null);}
+ if(target instanceof LinkItem){
+ commandList=getDropIntoCommand(((LinkItem)target).getParent(),((LinkItem)target).getReference() );}
+ }
+
+ else if(dropAdapter.getCurrentLocation()==ViewerDropAdapter.LOCATION_NONE){
+ }
+ break;
+ }
+ return commandList;
+ }
+ /**
+ * Test if a possibleSub eclass is a sub eclass
+ * @param aclass, cannot be null
+ * @param possibleSubClasse, cannot be null
+ * @return true if possible eclass is a subtype of a eclass or false
*/
public boolean isSubClass(EClassifier aclass, EClass possibleSubClasse){
if(aclass.equals(possibleSubClasse)){
@@ -164,26 +305,31 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
@Override
public IStatus validateDrop(Object target, int operation,
- TransferData transferType) {
- List<Command> commandList=getDropCommand(target);
+ TransferData transferType) {
+ List<Command> commandList=getDrop(target);
+ //List<Command> commandList=getDropCommand(target);
if(canDrop(commandList)){
-
return Status.OK_STATUS;
}
return Status.CANCEL_STATUS;
}
-/**
- * get the list of commands to drop an element
- * @param target
- * @return the list of the commands
- */
- protected List<Command> getDropCommand(final Object target) {
+
+ /**
+ * get the list of commands to drop an element
+ * @param target, can be null but do nothing
+ * @param the role where there is a drop ( can be null)
+ * @return the list of the commands
+ */
+ protected List<Command> getDropIntoCommand(final Object target, EReference eref) {
//init
ArrayList<Command> result= new ArrayList<Command>();
EObject targetEObject=null;
//target is an EObject?
+ if(target instanceof EObject){
+ targetEObject= ((EObject)target);
+ }
if(target instanceof IAdaptable){
targetEObject= ((EObject)((IAdaptable)target).getAdapter(EObject.class));
}
@@ -198,12 +344,63 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
Iterator<?> it=selectedElements.iterator();
while (it.hasNext()) {
Object object = it.next();
+ EObject eObjectchild=null;
+ if (object instanceof IAdaptable) {
+ eObjectchild = (EObject) ((IAdaptable) object).getAdapter(EObject.class);
+ }
+ else if(object instanceof EObject){
+ eObjectchild=(EObject)object;
+ }
+
+ if(eObjectchild instanceof Diagram){
+ result.addAll(getDropDiagramIntoCommand(getEditingDomain(), targetEObject,(Diagram) eObjectchild));
+ }
+ //test if object is an eobject
+ else if(eObjectchild!=null){
+
+ result.addAll(getDropIntoCommand(getEditingDomain(), targetEObject, eObjectchild, eref));
+ }
+
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * get the list of commands to drop an element
+ * @param target, can be null but do nothing
+ * @return the list of the commands
+ */
+ protected List<Command> getOrderChangeCommand(final Object target, boolean before) {
+
+ //init
+ ArrayList<Command> result= new ArrayList<Command>();
+ EObject objectLocation=null;
+ EObject objectOwner=null;
+
+ //target is an EObject?
+ if(target instanceof IAdaptable){
+ objectLocation= ((EObject)((IAdaptable)target).getAdapter(EObject.class));
+ objectOwner=objectLocation.eContainer();
+ }
+ if(objectLocation==null){
+ return result;
+ }
+
+ //get Command from the selection
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ List<?> selectedElements = ((IStructuredSelection) selection).toList();
+ Iterator<?> it=selectedElements.iterator();
+ while (it.hasNext()) {
+ Object object = it.next();
if (object instanceof IAdaptable) {
EObject eObjectchild = (EObject) ((IAdaptable) object).getAdapter(EObject.class);
//test if object is an eobject
- if(eObjectchild!=null){
+ if(eObjectchild!=null&& objectOwner!=null){
- result.addAll(getDropCommand(getEditingDomain(), targetEObject, eObjectchild));
+ result.addAll(getOrderChangeCommand(getEditingDomain(), objectOwner, objectLocation, eObjectchild, before));
}
}
}
@@ -211,18 +408,18 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD
return result;
}
-/**
- * get the editing domain
- * @return get the Transaction Editing Domain
- */
+ /**
+ * get the editing domain
+ * @return get the Transaction Editing Domain
+ */
protected TransactionalEditingDomain getEditingDomain() {
return EditorUtils.getTransactionalEditingDomain();
}
-
-/**
- *
- * @return multiDiagramEditor
- */
+
+ /**
+ *
+ * @return multiDiagramEditor
+ */
protected IMultiDiagramEditor getMultiDiagramEditor() {
IEditorPart editorPart = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/factory/DefaultEMFActionsFactory.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/factory/DefaultEMFActionsFactory.java
index 6c3f5e40d0b..f7454847d50 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/factory/DefaultEMFActionsFactory.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/factory/DefaultEMFActionsFactory.java
@@ -21,7 +21,6 @@ import java.util.List;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CopyAction;
import org.eclipse.emf.edit.ui.action.CutAction;
-import org.eclipse.emf.edit.ui.action.DeleteAction;
import org.eclipse.emf.edit.ui.action.LoadResourceAction;
import org.eclipse.emf.edit.ui.action.PasteAction;
import org.eclipse.emf.workspace.ui.actions.RedoActionWrapper;
@@ -47,8 +46,6 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
protected List<Action> actions = new LinkedList<Action>();
- protected DeleteAction deleteAction;
-
protected CutAction cutAction;
protected CopyAction copyAction;
@@ -61,51 +58,35 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
protected LoadResourceAction loadResourceAction;
- // protected ValidateAction validateAction;
-
/**
* {@inheritDoc}
*/
public List<Action> createActions(EditingDomain editingDomain) {
- ISharedImages sharedImages = PlatformUI.getWorkbench()
- .getSharedImages();
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
// Create Cut action
this.cutAction = new CutAction(editingDomain);
- this.cutAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
+ this.cutAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
actions.add(cutAction);
// Create Copy action
this.copyAction = new CopyAction(editingDomain);
- this.copyAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
+ this.copyAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
actions.add(copyAction);
// Create Paste action
this.pasteAction = new PasteAction(editingDomain);
- this.pasteAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
+ this.pasteAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
actions.add(pasteAction);
- // Create Delete action
- this.deleteAction = new DeleteAction(editingDomain, true);
- this.deleteAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- this.deleteAction.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- actions.add(deleteAction);
-
// Undo action
this.undoAction = new UndoActionWrapper();
- this.undoAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ this.undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
actions.add(undoAction);
// Redo action
this.redoAction = new RedoActionWrapper();
- this.redoAction.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+ this.redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
actions.add(redoAction);
// Load Resource action
@@ -119,7 +100,6 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
* {@inheritDoc}
*/
public void activate(CommonNavigator activeViewPart) {
- deleteAction.setActiveWorkbenchPart(activeViewPart);
cutAction.setActiveWorkbenchPart(activeViewPart);
copyAction.setActiveWorkbenchPart(activeViewPart);
pasteAction.setActiveWorkbenchPart(activeViewPart);
@@ -128,9 +108,8 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
loadResourceAction.setActiveWorkbenchPart(activeViewPart);
ISelectionProvider selectionProvider = null;
- if (activeViewPart.getCommonViewer() instanceof ISelectionProvider) {
+ if(activeViewPart.getCommonViewer() instanceof ISelectionProvider) {
selectionProvider = activeViewPart.getCommonViewer();
- selectionProvider.addSelectionChangedListener(deleteAction);
selectionProvider.addSelectionChangedListener(cutAction);
selectionProvider.addSelectionChangedListener(copyAction);
selectionProvider.addSelectionChangedListener(pasteAction);
@@ -141,7 +120,6 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
* {@inheritDoc}
*/
public void deactivate(CommonNavigator activeViewPart) {
- deleteAction.setActiveWorkbenchPart(null);
cutAction.setActiveWorkbenchPart(null);
copyAction.setActiveWorkbenchPart(null);
pasteAction.setActiveWorkbenchPart(null);
@@ -150,9 +128,8 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
loadResourceAction.setActiveWorkbenchPart(null);
ISelectionProvider selectionProvider = null;
- if (activeViewPart.getCommonViewer() instanceof ISelectionProvider) {
+ if(activeViewPart.getCommonViewer() instanceof ISelectionProvider) {
selectionProvider = activeViewPart.getCommonViewer();
- selectionProvider.removeSelectionChangedListener(deleteAction);
selectionProvider.removeSelectionChangedListener(cutAction);
selectionProvider.removeSelectionChangedListener(copyAction);
selectionProvider.removeSelectionChangedListener(pasteAction);
@@ -163,17 +140,11 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
* {@inheritDoc}
*/
public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
- deleteAction);
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction);
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
- copyAction);
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
- pasteAction);
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
- undoAction);
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
- redoAction);
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
}
/**
@@ -183,25 +154,19 @@ public class DefaultEMFActionsFactory implements IActionHandlerFactory {
public void update(IStructuredSelection structuredSelection) {
ArrayList array = new ArrayList();
Iterator iterator = structuredSelection.iterator();
- while (iterator.hasNext()) {
- Object object = (Object) iterator.next();
- if (NavigatorUtils.resolveSemanticObject(object) != null) {
+ while(iterator.hasNext()) {
+ Object object = (Object)iterator.next();
+ if(NavigatorUtils.resolveSemanticObject(object) != null) {
array.add(NavigatorUtils.resolveSemanticObject(object));
}
}
StructuredSelection st = new StructuredSelection(array);
- deleteAction.updateSelection(st);
- deleteAction.setEnabled((deleteAction.createCommand(st.toList()))
- .canExecute());
cutAction.updateSelection(st);
- cutAction.setEnabled((cutAction.createCommand(st.toList()))
- .canExecute());
+ cutAction.setEnabled((cutAction.createCommand(st.toList())).canExecute());
copyAction.updateSelection(st);
- copyAction.setEnabled((copyAction.createCommand(st.toList()))
- .canExecute());
+ copyAction.setEnabled((copyAction.createCommand(st.toList())).canExecute());
pasteAction.updateSelection(st);
- pasteAction.setEnabled((pasteAction.createCommand(st.toList()))
- .canExecute());
+ pasteAction.setEnabled((pasteAction.createCommand(st.toList())).canExecute());
loadResourceAction.update();
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/AbstractCommandHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/AbstractCommandHandler.java
new file mode 100644
index 00000000000..924a95b73f6
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/AbstractCommandHandler.java
@@ -0,0 +1,176 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.utils.BusinessModelResolver;
+import org.eclipse.papyrus.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.modelexplorer.Activator;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <pre>
+ *
+ * This abstract command handler manages:
+ * - current selection in order to build a list of the selected {@link EObject}
+ * - execute the command (returned by children) in Papyrus {@link TransactionalEditingDomain}
+ * - calculate the command enablement and visibility regarding the command executability
+ * (the command is now shown in menu if not executable).
+ *
+ * </pre>
+ */
+public abstract class AbstractCommandHandler extends AbstractHandler {
+
+ /**
+ * <pre>
+ *
+ * Returns the command to execute (to be implemented
+ * in children implementing this class)
+ *
+ * @return the command to execute
+ *
+ * </pre>
+ */
+ protected abstract Command getCommand();
+
+ /**
+ * <pre>
+ * Get the selected element, the first selected element if several are selected or null
+ * if no selection or the selection is not an {@link EObject}.
+ *
+ * @return selected {@link EObject} or null
+ * </pre>
+ *
+ */
+ protected EObject getSelectedElement() {
+ EObject eObject = null;
+ Object selection = null;
+
+ // Get current selection
+ selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ // Get first element if the selection is an IStructuredSelection
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ selection = structuredSelection.getFirstElement();
+ }
+
+ // Treat non-null selected object (try to adapt and return EObject)
+ if(selection != null) {
+
+ if(selection instanceof IAdaptable) {
+ selection = ((IAdaptable)selection).getAdapter(EObject.class);
+ }
+
+ Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(selection);
+ if(businessObject instanceof EObject) {
+ eObject = (EObject)businessObject;
+ }
+ }
+ return eObject;
+ }
+
+ /**
+ * <pre>
+ * Parse current selection and extract the list of {@link EObject} from
+ * this selection.
+ *
+ * This also tries to adapt selected element into {@link EObject}
+ * (for example to get the {@link EObject} from a selection in the ModelExplorer).
+ *
+ * @return a list of currently selected {@link EObject}
+ * </pre>
+ *
+ */
+ protected List<EObject> getSelectedElements() {
+
+ List<EObject> selectedEObjects = new ArrayList<EObject>();
+
+ // Parse current selection
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ for(Object current : structuredSelection.toArray()) {
+ // Adapt current selection to EObject
+ if(current instanceof IAdaptable) {
+ selectedEObjects.add((EObject)((IAdaptable)current).getAdapter(EObject.class));
+ }
+ }
+ } else { // Not a IStructuredSelection
+ if(selection != null) {
+ // Adapt current selection to EObject
+ if(selection instanceof IAdaptable) {
+ selectedEObjects.add((EObject)((IAdaptable)selection).getAdapter(EObject.class));
+ }
+ }
+ }
+
+ return selectedEObjects;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return null
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ try {
+
+ ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ util.getTransactionalEditingDomain().getCommandStack().execute(getCommand());
+
+ } catch (ServiceException e) {
+
+ Activator.log.error("Unexpected error while executing command.", e);
+
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return true (enabled) when the command can be executed.
+ */
+ public boolean isEnabled() {
+ return getCommand().canExecute();
+ }
+
+ /**
+ *
+ * @return true (visible) when the command can be executed.
+ */
+ public boolean isVisible() {
+ return getCommand().canExecute();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/DeleteCommandHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/DeleteCommandHandler.java
new file mode 100644
index 00000000000..f5f0af8d0fd
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/DeleteCommandHandler.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+
+/**
+ * Default handler for Delete command used in the ModelExplorer contextual menu.
+ *
+ */
+public class DeleteCommandHandler extends AbstractCommandHandler implements IHandler {
+
+ /** Current deleteCommand for selection (updated in {@link DeleteCommandHandler#isEnabled()}) */
+ private Command deleteCommand;
+
+ /**
+ * <pre>
+ *
+ * Build the delete command for a set of EObject selected in the ModelExplorer.
+ * The delete command is given by the {@link IElementEditService} of selected
+ * elements.
+ *
+ * @return the composite deletion command for current selection
+ *
+ * @TODO : Manage possible Diagrams listed in the selection
+ *
+ * </pre>
+ */
+ private Command buildCommand() {
+
+ ICommand gmfCommand = null;
+ for(EObject selectedEObject : getSelectedElements()) {
+
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if(provider == null) {
+ continue;
+ }
+
+ // Retrieve delete command from the Element Edit service
+ DestroyElementRequest request = new DestroyElementRequest(selectedEObject, false);
+ ICommand deleteCommand = provider.getEditCommand(request);
+
+ // Add current EObject destroy command to the global command
+ gmfCommand = CompositeCommand.compose(gmfCommand, deleteCommand);
+ }
+
+ if(gmfCommand == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ Command emfCommand = new GMFtoEMFCommandWrapper(gmfCommand.reduce());
+ return emfCommand;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return current command (only built here when the stored command is null)
+ */
+ protected Command getCommand() {
+
+ // Build the delete command in case it is not initialized.
+ if(deleteCommand == null) {
+ deleteCommand = buildCommand();
+ }
+
+ return deleteCommand;
+ }
+
+ /**
+ * <pre>
+ *
+ * Calculates whether the handler is enabled or not. The command is re-built on the
+ * basis of current selection before any attempt to test if current command can be executed.
+ *
+ * @see org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler#isEnabled()
+ *
+ * @return true if the command can be executed
+ *
+ * </pre>
+ */
+ public boolean isEnabled() {
+
+ // Prepare and store the delete command only when trying to find out
+ // whether the command is enabled or not.
+ // This assumes the isEnabled() method is called each time the contextual menu
+ // opens.
+ deleteCommand = buildCommand();
+
+ return super.isEnabled();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/GMFtoEMFCommandWrapper.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/GMFtoEMFCommandWrapper.java
new file mode 100644
index 00000000000..0740d0c9442
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/GMFtoEMFCommandWrapper.java
@@ -0,0 +1,129 @@
+/***************************************************************************
+ * Copyright (c) 2007 Conselleria de Infraestructuras y Transporte,
+ * Generalitat de la Comunitat Valenciana . All rights reserved. This program
+ * and the accompanying materials are made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Mario Cervera Ubeda (Prodevelop)
+ *
+ *
+ *
+ * <pre>
+ * @TODO : This class is copied as is from oep.diagram.common to avoid adding
+ * an undesired dependency between the model explorer plug-in and oep.diagram.common.
+ * oep.diagram.common should probably be split, moving general utility classes
+ * like this wrapper in a separate plug-in.
+ * </pre>
+ *
+ ******************************************************************************/
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+
+/**
+ * A EMF Command that wraps a GMF command. Each method is redirected to the GMF one.
+ */
+public class GMFtoEMFCommandWrapper extends AbstractCommand {
+
+ /**
+ * The wrapped GMF Command. Package-level visibility so that the command stack wrapper can
+ * access the field.
+ */
+ private final ICommand gmfCommand;
+
+ /**
+ * Constructor.
+ *
+ * @param gmfCommand
+ * the gmf command
+ */
+ public GMFtoEMFCommandWrapper(ICommand gmfCommand) {
+ super(gmfCommand.getLabel());
+ this.gmfCommand = gmfCommand;
+ }
+
+ /**
+ * Returns the wrapped GMF command.
+ *
+ * @return the GMF command
+ */
+ // @unused
+ public ICommand getGMFCommand() {
+ return gmfCommand;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
+ */
+ @Override
+ public boolean canExecute() {
+ return gmfCommand.canExecute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#dispose()
+ */
+ @Override
+ public void dispose() {
+ gmfCommand.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#canUndo()
+ */
+ @Override
+ public boolean canUndo() {
+ return gmfCommand.canUndo();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ */
+ public void execute() {
+ try {
+ gmfCommand.execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ public void redo() {
+ try {
+ gmfCommand.redo(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ */
+ @Override
+ public void undo() {
+ try {
+ gmfCommand.undo(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ }
+
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/LoadBrowserCustomization.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/LoadBrowserCustomization.java
index bcdb12e31d1..f8c4bbd25fd 100644
--- a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/LoadBrowserCustomization.java
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/LoadBrowserCustomization.java
@@ -43,6 +43,7 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.core.utils.DiResourceSet;
import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.modelexplorer.Activator;
+import org.eclipse.papyrus.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.navigator.CommonNavigator;
@@ -61,9 +62,13 @@ public class LoadBrowserCustomization extends AbstractHandler {
*/
protected CommonNavigator getCommonNavigator() {
IViewPart part = org.eclipse.papyrus.modelexplorer.NavigatorUtils
- .findViewPart("org.eclipse.papyrus.modelexplorer.modelexplorer");
- if (part instanceof CommonNavigator) {
- return ((CommonNavigator) part);
+.findViewPart("org.eclipse.papyrus.modelexplorer.modelexplorer"); // FIXME should use a constant here!
+ // the part is only a book, retrieving correct page
+ if (part instanceof ModelExplorerPageBookView) {
+ IViewPart page = ((ModelExplorerPageBookView)part).getActiveView();
+ if(page instanceof CommonNavigator) {
+ return ((CommonNavigator)page);
+ }
}
return null;
}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/SortElementHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/SortElementHandler.java
new file mode 100644
index 00000000000..a4e19467177
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/SortElementHandler.java
@@ -0,0 +1,101 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.gmt.modisco.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.core.ui.pagebookview.MultiViewPageBookView;
+import org.eclipse.papyrus.modelexplorer.Activator;
+import org.eclipse.papyrus.modelexplorer.CustomCommonViewer;
+import org.eclipse.papyrus.modelexplorer.ModelExplorerView;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonViewerSorter;
+/**
+ * this handler is used to set a sorter on the model explorer
+ *
+ */
+public class SortElementHandler extends AbstractHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (Activator.getDefault().getCustomizationManager() != null) {
+ CustomizationManager customizationManager = Activator.getDefault()
+ .getCustomizationManager();
+ if(((ToolItem)((Event)event.getTrigger()).widget).getSelection()){
+ getSelectedTreeViewer(event).setSorter(new CommonViewerSorter());
+ if(getSelectedTreeViewer(event) instanceof CustomCommonViewer){
+ ((CustomCommonViewer)getSelectedTreeViewer(event)).getDropAdapter().setFeedbackEnabled(false);
+ }
+ }
+ else{
+ getSelectedTreeViewer(event).setSorter(null);
+ if(getSelectedTreeViewer(event) instanceof CustomCommonViewer){
+ ((CustomCommonViewer)getSelectedTreeViewer(event)).getDropAdapter().setFeedbackEnabled(true);
+ }
+
+ }
+ getSelectedTreeViewer(event).refresh();
+ }
+ return null;
+ }
+
+ /**
+ * used to obtain the tree viewer of the model explorer
+ * @param event
+ * @return
+ */
+ protected TreeViewer getSelectedTreeViewer(ExecutionEvent event) {
+
+ IWorkbenchPart activePart;
+ // Try to get the active part
+
+ // Try to get the TreeViewer from the evaluation context
+ if( event.getApplicationContext() instanceof EvaluationContext) {
+ EvaluationContext context = (EvaluationContext)event.getApplicationContext();
+ // activeEditor, activeSite, selection, activeShell, activePart
+ Object site = context.getVariable("activeSite");
+ activePart = (IWorkbenchPart)context.getVariable("activePart");
+ }
+ else {
+ activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+ }
+
+ if(activePart instanceof TreeViewer)
+ return (TreeViewer)activePart;
+
+ if( activePart instanceof MultiViewPageBookView)
+ {
+ MultiViewPageBookView pageBookView =(MultiViewPageBookView)activePart;
+ IViewPart viewPart = pageBookView.getActiveView();
+ if(viewPart instanceof ModelExplorerView)
+ {
+ return ((ModelExplorerView)viewPart).getCommonViewer();
+ }
+ }
+
+ // Not found
+ return null;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromModelHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromModelHandler.java
new file mode 100644
index 00000000000..e685c344ea1
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromModelHandler.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.modelexplorer.commands.ValidateDelMarkersFromModelCommand;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element represented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+public class ValidateDelMarkersFromModelHandler extends AbstractCommandHandler
+{
+ @Override
+ protected Command getCommand() {
+ // not useful to cache command, since selected element may change
+ return new GMFtoEMFCommandWrapper(new ValidateDelMarkersFromModelCommand(getSelectedElement()));
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromSubtreeHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromSubtreeHandler.java
new file mode 100644
index 00000000000..61f94bd0072
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateDelMarkersFromSubtreeHandler.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.modelexplorer.commands.ValidateDelMarkersFromSubtreeCommand;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element represented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+public class ValidateDelMarkersFromSubtreeHandler extends AbstractCommandHandler
+{
+ @Override
+ protected Command getCommand() {
+ // not useful to cache command, since selected element may change
+ return new GMFtoEMFCommandWrapper(new ValidateDelMarkersFromSubtreeCommand(getSelectedElement()));
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateModelHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateModelHandler.java
new file mode 100644
index 00000000000..ec6e7f61186
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateModelHandler.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.modelexplorer.commands.ValidateModelCommand;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element represented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+public class ValidateModelHandler extends AbstractCommandHandler
+{
+ @Override
+ protected Command getCommand() {
+ // not useful to cache command, since selected element may change
+ return new GMFtoEMFCommandWrapper(new ValidateModelCommand(getSelectedElement()));
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateSubtreeHandler.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateSubtreeHandler.java
new file mode 100644
index 00000000000..4097ccc4fef
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/handler/ValidateSubtreeHandler.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.handler;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.modelexplorer.commands.ValidateSubtreeCommand;
+
+/**
+ * Action used for pasting either a model element or a shape (i.e. the model element represented
+ * by the shape). Delegates to PasteShapeOrElementCommand
+ *
+ * @author Ansgar Radermacher (CEA LIST)
+ */
+public class ValidateSubtreeHandler extends AbstractCommandHandler
+{
+ @Override
+ protected Command getCommand() {
+ // not useful to cache command, since selected element may change
+ return new GMFtoEMFCommandWrapper(new ValidateSubtreeCommand(getSelectedElement()));
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/listener/DoubleClickListener.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/listener/DoubleClickListener.java
new file mode 100644
index 00000000000..f3ca1985f32
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/listener/DoubleClickListener.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.listener;
+
+import java.util.Iterator;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.modelexplorer.Activator;
+import org.eclipse.papyrus.sasheditor.contentprovider.IPageMngr;
+
+/**
+ * this class is a listener in charge to manage double on element of the model explorer
+ *
+ */
+public class DoubleClickListener implements IDoubleClickListener {
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ *
+ */
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection= event.getSelection();
+ IPageMngr pageMngr=null;
+ //get the page Manager
+ try {
+ pageMngr = ServiceUtilsForActionHandlers.getInstance().getIPageMngr();
+ } catch (Exception e) {
+ Activator.log.error("Impossibility to load the page manager", e);
+ }
+ if(pageMngr!=null){
+ if( selection instanceof IStructuredSelection){
+ Iterator iter=((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object currentObject = (Object)iter.next();
+ if(currentObject instanceof Diagram){
+ // open the page
+ pageMngr.openPage(currentObject);
+ }
+
+
+ }
+ }
+
+ }}
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/provider/ActionStateSourceProvider.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/provider/ActionStateSourceProvider.java
new file mode 100644
index 00000000000..842c88e3350
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/provider/ActionStateSourceProvider.java
@@ -0,0 +1,294 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.modelexplorer.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.modelexplorer.handler.DeleteCommandHandler;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.AbstractSourceProvider;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPartService;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * This class provides the state for the Delete Action in the Model Explorer.
+ * This state is used to refresh the status of this action in the Edit Menu.
+ *
+ * To get the status, we listen the selection service AND the part service!
+ * The part service is used to know if the selection is in the Model Explorer or not!
+ * When the selection is not in the model explorer, the handlers listening the variable need to be disabled
+ *
+ */
+public class ActionStateSourceProvider extends AbstractSourceProvider {
+
+ /**
+ * The name of the variable to check.
+ */
+ public static final String DELETE_IN_MODEL_EXPLORER = "deleteInModelExplorer";
+
+ /**
+ * The enabled state value.
+ */
+ private static final String ENABLED = "enabled";
+
+ /**
+ * The disabled state value.
+ */
+ private static final String DISABLED = "disabled";
+
+ /**
+ * Map used to register the state of the actions
+ */
+ private final HashMap<String, String> currentState = new HashMap<String, String>(2);
+
+ /**
+ * The selection service
+ */
+ private ISelectionService selectionService;
+
+ /**
+ * The listener for the selection service
+ */
+ private ISelectionListener selectionListener;
+
+ /**
+ * the listener for the part service
+ */
+ private IPartService partService;
+
+ /**
+ * The listener for the part service
+ */
+ private IPartListener partListener;
+
+ /**
+ * Title of the activated part
+ */
+ private String title = null;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public ActionStateSourceProvider() {
+ currentState.put(DELETE_IN_MODEL_EXPLORER, DISABLED);
+ selectionListener = new SelectionListener();
+ partListener = new PartListener();
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#dispose()
+ *
+ */
+ public void dispose() {
+ if(selectionService != null) {
+ selectionService.removeSelectionListener(selectionListener);
+ }
+ if(partService != null) {
+ partService.removePartListener(partListener);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#getCurrentState()
+ *
+ * @return
+ */
+ public Map<String, String> getCurrentState() {
+ addSelectionListener();
+ addPartListener();
+ return currentState;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
+ *
+ * @return
+ */
+ public String[] getProvidedSourceNames() {
+ return new String[]{ DELETE_IN_MODEL_EXPLORER };
+ }
+
+ /**
+ * Adds a listener on the selection service if the field {@link #selectionService} is <code>null</code>
+ */
+ protected void addSelectionListener() {
+ if(this.selectionService == null) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ selectionService = (ISelectionService)workbench.getService(ISelectionService.class);
+ IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if(activeWorkbench != null) {
+ selectionService = activeWorkbench.getSelectionService();
+ if(selectionService != null) {
+ selectionService.addSelectionListener(selectionListener);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ protected void addPartListener() {
+ if(this.partService == null) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ partService = (IPartService)workbench.getService(IPartService.class);
+ IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if(activeWorkbench != null) {
+ partService = activeWorkbench.getPartService();
+ if(partService != null) {
+ partService.addPartListener(partListener);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Refresh the state of the Delete Action
+ */
+ protected boolean testDeleteFromModelExplorer() {
+ DeleteCommandHandler handler = new DeleteCommandHandler();
+ return isSelectionInModelExplorer() && handler.isEnabled();
+ }
+
+ /**
+ * Tests if the Delete action can be executed
+ *
+ * @return
+ * <code>true</code> if the Delete action can be executed <code>false</code> if not
+ */
+ protected void refreshDeleteAction() {
+ String oldState = currentState.get(DELETE_IN_MODEL_EXPLORER);
+ String newState = (testDeleteFromModelExplorer() ? ENABLED : DISABLED);
+
+ if(oldState != newState) {
+ currentState.put(DELETE_IN_MODEL_EXPLORER, newState);
+ fireSourceChanged(ISources.WORKBENCH, currentState);
+ }
+ }
+
+ /**
+ * Test if the current ActivePart is the Model Explorer
+ *
+ * @return
+ * <code>true</code> if the current activePart is the Model Explorer <code>false</code> if not
+ */
+ protected boolean isSelectionInModelExplorer() {
+ return (title != null) ? title.equals("Model Explorer") : false;
+ }
+
+ /**
+ *
+ * The class {@link PartListener}
+ *
+ *
+ */
+ public class PartListener implements IPartListener {
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partOpened(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partDeactivated(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partClosed(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partActivated(IWorkbenchPart part) {
+ title = part.getTitle();
+ refreshDeleteAction();
+ }
+
+
+ }
+
+ /**
+ *
+ * This class provides the listener for the selection service
+ *
+ */
+ public class SelectionListener implements ISelectionListener {
+
+ /**
+ *
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ *
+ * @param part
+ * @param selection
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ refreshDeleteAction();
+ }
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/validation/ValidationTool.java b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/validation/ValidationTool.java
new file mode 100644
index 00000000000..aa498a0a20a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.modelexplorer/src/org/eclipse/papyrus/modelexplorer/validation/ValidationTool.java
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.modelexplorer.validation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.LinkItem;
+import org.eclipse.papyrus.core.utils.ValidationUtils;
+
+public class ValidationTool {
+
+ public ValidationTool (Object element) {
+ this.element = element;
+ eObject = (EObject) Platform.getAdapterManager().getAdapter(element, EObject.class);
+ }
+
+ public ValidationTool (EObject eObject) {
+ this.eObject = eObject;
+ }
+
+ public void tryChildIfEmpty() {
+ // element has no eObject. try parent
+ if (eObject == null) {
+ // TODO: is it possible to access the children in another way (without internal access?)
+ if (element instanceof LinkItem) {
+ List<EObject> items = ((LinkItem) element).getChildrenElements();
+ if (items.size() > 0) {
+ // element = items[0];
+ eObject = items.get(0);
+ }
+ }
+ }
+ }
+
+ public EObject getEObject () {
+ return eObject;
+ }
+
+ public IMarker [] getMarkers () {
+ if (eObject != null) {
+ if (eObject.eResource () != null) {
+ URI uri = eObject.eResource().getURI();
+ String platformResourceString = uri.toPlatformString(true);
+ IFile file = (platformResourceString != null ?
+ ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformResourceString)) : null);
+ if (file != null) {
+ try {
+ // TODO: quite inefficient, since requested for each element (could cache markers, already done
+ // by findMarkers operation?)
+ return file.findMarkers(IMarker.PROBLEM, true, 0);
+ }
+ catch (CoreException e) {
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public EObject eObjectOfMarker (IMarker marker) {
+ if (eObject != null) {
+ domain = AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
+ try {
+ if (marker.isSubtypeOf((EValidator.MARKER))) {
+ return ValidationUtils.eObjectFromMarkerOrMap (marker, null, domain);
+ }
+ }
+ catch (CoreException e) {
+ // only reason: marker does not exist
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Delete all markers that refer to eObjects owned by the passed parentEObj
+ * @param eObj
+ */
+ public void deleteSubMarkers() {
+ for (IMarker marker : getMarkers ()) {
+ EObject eObjOfMarker = eObjectOfMarker (marker);
+ if (isContainedBy (eObjOfMarker, eObject)) {
+ try {
+ marker.delete ();
+ }
+ catch (CoreException e) {
+ }
+ }
+ }
+ }
+
+ private boolean isContainedBy (EObject subEObj, EObject eObj) {
+ if (eObj == subEObj) return true;
+ else if (subEObj != null) {
+ return isContainedBy (subEObj.eContainer(), eObj);
+ }
+ // reached, if subEObj == null
+ return false;
+ }
+
+ private Object element;
+ private EObject eObject;
+ private EditingDomain domain;
+}
diff --git a/plugins/core/org.eclipse.papyrus.perspective/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.perspective/META-INF/MANIFEST.MF
index b14d84fcaa7..253dedecde6 100644
--- a/plugins/core/org.eclipse.papyrus.perspective/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.perspective/META-INF/MANIFEST.MF
@@ -1,11 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Perspective
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.perspective;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.perspective.Activator
Require-Bundle: org.eclipse.papyrus.diagram.common;bundle-version="0.7.0",
org.eclipse.papyrus.wizards;bundle-version="0.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.papyrus.perspective
+Bundle-Vendor: %providerName
diff --git a/plugins/core/org.eclipse.papyrus.perspective/build.properties b/plugins/core/org.eclipse.papyrus.perspective/build.properties
index 983cdc39a95..00fbcdb3333 100644
--- a/plugins/core/org.eclipse.papyrus.perspective/build.properties
+++ b/plugins/core/org.eclipse.papyrus.perspective/build.properties
@@ -4,4 +4,9 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
- about.html
+ about.html,\
+ plugin.properties
+src.includes = icons/,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
diff --git a/plugins/core/org.eclipse.papyrus.perspective/plugin.properties b/plugins/core/org.eclipse.papyrus.perspective/plugin.properties
new file mode 100644
index 00000000000..d72cc4dc09a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.perspective/plugin.properties
@@ -0,0 +1,14 @@
+########################################################################################
+#
+# Copyright (c) 2010 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# CEA LIST - initial API and implementation
+########################################################################################
+pluginName=Papyrus Perspective (Incubation)
+providerName=Eclipse Modeling Project
+
diff --git a/plugins/core/org.eclipse.papyrus.preferences/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.preferences/META-INF/MANIFEST.MF
index f92995f5b34..276411aa314 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.preferences/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.preferences;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.preferences.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties,
diff --git a/plugins/core/org.eclipse.papyrus.preferences/plugin.properties b/plugins/core/org.eclipse.papyrus.preferences/plugin.properties
index 5045d84aa83..b1e3391bd11 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.preferences/plugin.properties
@@ -11,4 +11,4 @@
#
#############################################################################/
pluginName=Papyrus Preferences (Incubation)
-providerName=Eclipse.org \ No newline at end of file
+providerName=Eclipse Modeling Project \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Activator.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Activator.java
index 9f700559bc2..e12333d90cf 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Activator.java
@@ -31,19 +31,21 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
/** Logging helper */
- public static LogHelper log;
+ public static LogHelper log;
+
/**
* The constructor
*/
public Activator() {
}
- /**
- * Storage for preferences.
- */
- protected IPreferenceStore papyrusPreferenceStore;
+ /**
+ * Storage for preferences.
+ */
+ protected IPreferenceStore papyrusPreferenceStore;
+
/*
* (non-Javadoc)
*
@@ -53,17 +55,18 @@ public class Activator extends AbstractUIPlugin {
super.start(context);
plugin = this;
// register the login helper
- log = new LogHelper(plugin);
+ log = new LogHelper(plugin);
}
- public IPreferenceStore getPreferenceStore() {
- // Create the preference store lazily.
- if (papyrusPreferenceStore == null) {
- papyrusPreferenceStore = new PapyrusPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if(papyrusPreferenceStore == null) {
+ papyrusPreferenceStore = new PapyrusPreferenceStore(new InstanceScope(), getBundle().getSymbolicName());
+
+ }
+ return papyrusPreferenceStore;
+ }
- }
- return papyrusPreferenceStore;
- }
/*
* (non-Javadoc)
*
@@ -97,7 +100,7 @@ public class Activator extends AbstractUIPlugin {
image = registry.get(key);
}
-
+
return image;
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Messages.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Messages.java
index 7c9a21fc773..50699a0678a 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Messages.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/Messages.java
@@ -80,9 +80,14 @@ public class Messages extends NLS {
public static String GradientFieldEditor_Transparency;
public static String GradientFieldEditor_Vertical;
+
public static String DecorationGroup_Name;
-
- public static String DimensionGroupName ;
+
+ public static String DimensionGroupName;
+
+
+
+ public static String NodeCompartmentGroup_Compartiments;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceInitializer.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceInitializer.java
index b93cf88da36..58693bd1f1b 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceInitializer.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceInitializer.java
@@ -20,22 +20,23 @@ import org.eclipse.papyrus.preferences.pages.internal.PapyrusPathmapsPreferenceP
import org.eclipse.papyrus.preferences.pages.internal.PapyrusPrintingPreferencePage;
import org.eclipse.papyrus.preferences.pages.internal.PapyrusRulersAndGridPreferencePage;
import org.eclipse.papyrus.preferences.pages.internal.PapyrusUML2PreferencePage;
+
/**
* This class is use to initialize the preference at the level Papyrus editor
- *
+ *
*/
public class PapyrusPreferenceInitializer extends AbstractPreferenceInitializer {
private IPreferenceStore store;
-/**
- * constructor of this class
- */
+ /**
+ * constructor of this class
+ */
public PapyrusPreferenceInitializer() {
- store= Activator.getDefault().getPreferenceStore();
+ store = Activator.getDefault().getPreferenceStore();
}
-
+
@Override
public void initializeDefaultPreferences() {
PapyrusAllDiagramsPreferencePage.initDefaults(store);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceStore.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceStore.java
index 7789ef2f465..c603ddc367f 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceStore.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusPreferenceStore.java
@@ -23,53 +23,54 @@ import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
/**
* this class is a specific store that is used to look for value of element
- * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram
- *
+ * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram
+ *
*/
public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
+
/**
* this method is used to overload all value under a level of preferences.
* In order to overload a pop-up is opened, and the user can choose value to overload
- * @param level of preference: Editor or diagram
+ *
+ * @param level
+ * of preference: Editor or diagram
*/
- public void deleteAllSubPreference(String level){
+ public void deleteAllSubPreference(String level) {
//remove all sub value diagram+ element
- ArrayList<String> keytoRemove=new ArrayList<String>();
+ ArrayList<String> keytoRemove = new ArrayList<String>();
//key to collect
- ArrayList<String> elementKey= new ArrayList<String>();
- try{
- for (int i=0; i<getStorePreferences().keys().length;i++){
+ ArrayList<String> elementKey = new ArrayList<String>();
+ try {
+ for(int i = 0; i < getStorePreferences().keys().length; i++) {
//level diagram collect only element
- if( level.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
- if(getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
+ if(level.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
elementKey.add(getStorePreferences().keys()[i]);
}
}
//editor level, collect all element+diagram
- else if( level.startsWith(PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX)){
- if((getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT))
- ||(getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX))){
+ else if(level.startsWith(PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX)) {
+ if((getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) || (getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX))) {
elementKey.add(getStorePreferences().keys()[i]);
}
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
Activator.log.error(e);
}
- if(elementKey.size()>0){
- String[] keyRoconsult= new String[elementKey.size()];
- ApplyValueOnPreferenceKeyDialog dialog= new ApplyValueOnPreferenceKeyDialog(elementKey.toArray(keyRoconsult));
+ if(elementKey.size() > 0) {
+ String[] keyRoconsult = new String[elementKey.size()];
+ ApplyValueOnPreferenceKeyDialog dialog = new ApplyValueOnPreferenceKeyDialog(elementKey.toArray(keyRoconsult));
dialog.open();
- keytoRemove=dialog.getKeyToRemove();
+ keytoRemove = dialog.getKeyToRemove();
//remove key
- Iterator<String> iterator= keytoRemove.iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
+ Iterator<String> iterator = keytoRemove.iterator();
+ while(iterator.hasNext()) {
+ String key = (String)iterator.next();
getStorePreferences().remove(key);
}
}
@@ -78,25 +79,27 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
/**
* constructor
+ *
* @param context
- * the scope to store to
+ * the scope to store to
* @param qualifier
- * the qualifier used to look up the preference node
+ * the qualifier used to look up the preference node
*/
public PapyrusPreferenceStore(IScopeContext context, String qualifier) {
super(context, qualifier);
}
+
/**
* constructor
+ *
* @param context
- * the scope to store to
+ * the scope to store to
* @param qualifier
- * the qualifier used to look up the preference node
+ * the qualifier used to look up the preference node
* @param defaultQualifierPath
- * the qualifier used when looking up the defaults
+ * the qualifier used when looking up the defaults
*/
- public PapyrusPreferenceStore(IScopeContext context, String qualifier,
- String defaultQualifierPath) {
+ public PapyrusPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
super(context, qualifier, defaultQualifierPath);
}
@@ -110,95 +113,100 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
* if the key is an element. The method look for if this key exist. If no value exists, it look for the key for diagram
* if the key for diagram do not exist it look for key for papyrus Editor
* the structure of Key is:
- * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
- * Diagram : DIAGRAM_DiagramKind.preferenceKind
- * Editor: PAPYRUS_EDITOR.preferenceKind
- *
+ * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
+ * Diagram : DIAGRAM_DiagramKind.preferenceKind
+ * Editor: PAPYRUS_EDITOR.preferenceKind
+ *
*/
- protected String findKeyWithAValue(String initialKey){
- String foundedKey=null;
+ protected String findKeyWithAValue(String initialKey) {
+ String foundedKey = null;
//first look for in value stack
- foundedKey=findKeyAStoreValue(initialKey);
+ foundedKey = findKeyAStoreValue(initialKey);
//then look for in default stack
- if(foundedKey==null){
- foundedKey=findKeyWithADefaultValue(initialKey);
+ if(foundedKey == null) {
+ foundedKey = findKeyWithADefaultValue(initialKey);
}
- if(foundedKey==null){
- foundedKey=initialKey;
+ if(foundedKey == null) {
+ foundedKey = initialKey;
}
return foundedKey;
}
+
/**
* look for a key with a value in the store stack
+ *
* @param initialKey
- * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
- * Diagram : DIAGRAM_DiagramKind.preferenceKind
- * Editor: PAPYRUS_EDITOR.preferenceKind
+ * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
+ * Diagram : DIAGRAM_DiagramKind.preferenceKind
+ * Editor: PAPYRUS_EDITOR.preferenceKind
* @return the key that returns a value or null if there is no value
*/
- protected String findKeyAStoreValue(String initialKey){
- String foundedKey=null;
- if(getStorePreferences().get(initialKey, null)!=null){
- foundedKey=initialKey;
+ protected String findKeyAStoreValue(String initialKey) {
+ String foundedKey = null;
+ if(getStorePreferences().get(initialKey, null) != null) {
+ foundedKey = initialKey;
}
- if(foundedKey==null&& hasPrefix(initialKey)){
- foundedKey= findKeyAStoreValue(getUpperKey(initialKey));
+ if(foundedKey == null && hasPrefix(initialKey)) {
+ foundedKey = findKeyAStoreValue(getUpperKey(initialKey));
}
return foundedKey;
}
+
/**
* this method is used to find a key that a got a value:
* if the key is an element. The method look for if this key exist. If no value exists, it look for the key for diagram
* if the key for diagram do not exist it look for key for papyrus Editor
* the structure of Key is:
- * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
- * Diagram : DIAGRAM_DiagramKind.preferenceKind
- * Editor: PAPYRUS_EDITOR.preferenceKind
- *
+ * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
+ * Diagram : DIAGRAM_DiagramKind.preferenceKind
+ * Editor: PAPYRUS_EDITOR.preferenceKind
+ *
*/
- protected String findKeyWithADefaultValue(String initialKey){
- String foundedKey=null;
+ protected String findKeyWithADefaultValue(String initialKey) {
+ String foundedKey = null;
- if(getDefaultPreferences().get(initialKey, null)!=null){
- foundedKey=initialKey;
+ if(getDefaultPreferences().get(initialKey, null) != null) {
+ foundedKey = initialKey;
}
- if(foundedKey==null&& hasPrefix(initialKey)){
+ if(foundedKey == null && hasPrefix(initialKey)) {
return findKeyWithADefaultValue(getUpperKey(initialKey));
- }
- else{
- foundedKey=initialKey;
+ } else {
+ foundedKey = initialKey;
}
return foundedKey;
}
+
/**
* get the upper Key from the initial Key
* * the structure of Key is:
- * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
- * Diagram : DIAGRAM_DiagramKind.preferenceKind
- * Editor: PAPYRUS_EDITOR.preferenceKind
+ * element : ELEMENT_DiagramKind_ElementKind.preferenceKind
+ * Diagram : DIAGRAM_DiagramKind.preferenceKind
+ * Editor: PAPYRUS_EDITOR.preferenceKind
+ *
* @param initialKey
* @return the upperKey
*
*/
- protected String getUpperKey(String initialKey){
+ protected String getUpperKey(String initialKey) {
- String out=initialKey.toString();
- if( initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
- out=initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX);
- out =out.substring(0, out.lastIndexOf("_"))+out.substring(out.indexOf("."), out.length());
+ String out = initialKey.toString();
+ if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX);
+ out = out.substring(0, out.lastIndexOf("_")) + out.substring(out.indexOf("."), out.length());
}
- if( initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
+ if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
// out=initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX, PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX);
- out=PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX+out.substring(out.indexOf("."), out.length());
+ out = PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX + out.substring(out.indexOf("."), out.length());
}
return out;
}
- protected boolean hasPrefix(String key){
- if(key.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)|| key.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
+
+ protected boolean hasPrefix(String key) {
+ if(key.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT) || key.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
return true;
}
return false;
@@ -206,20 +214,21 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
/**
* get the value from a key
+ *
* @param key
* @return the value
*/
protected String internalGet(String key) {
- String newKey= findKeyWithAValue(key);
+ String newKey = findKeyWithAValue(key);
//System.err.println("-->Initial Key "+key+"--> "+ newKey);
- return Platform.getPreferencesService().get(newKey, null,
- getPreferenceNodes(true));
+ return Platform.getPreferencesService().get(newKey, null, getPreferenceNodes(true));
}
- public boolean getDefaultBoolean(String name){
+ public boolean getDefaultBoolean(String name) {
return super.getDefaultBoolean(findKeyWithADefaultValue(name));
}
+
public double getDefaultDouble(String name) {
return super.getDefaultDouble(findKeyWithADefaultValue(name));
}
@@ -227,12 +236,15 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
public float getDefaultFloat(String name) {
return super.getDefaultFloat(findKeyWithADefaultValue(name));
};
+
public int getDefaultInt(String name) {
return super.getDefaultInt(findKeyWithADefaultValue(name));
}
+
public long getDefaultLong(String name) {
return super.getDefaultLong(findKeyWithADefaultValue(name));
}
+
public String getDefaultString(String name) {
return super.getDefaultString(findKeyWithADefaultValue(name));
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusScopedPreferenceStore.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusScopedPreferenceStore.java
index c7d4fb3aa97..2256d82ff90 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusScopedPreferenceStore.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/PapyrusScopedPreferenceStore.java
@@ -12,8 +12,9 @@
*
*****************************************************************************/
package org.eclipse.papyrus.preferences;
+
/***************************************************************************
-Copyright (c) 2010 CEA LIST.
+ Copyright (c) 2010 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -22,14 +23,14 @@ Copyright (c) 2010 CEA LIST.
* http://www.eclipse.org/legal/epl-v10.html
*
*
-* Contributors:
-* the code is copy from ScopedPreferenceStore but I have open some methods in order to be
-* available for the overload
-*
-* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
-*
-*
-*******************************************************************************/
+ * Contributors:
+ * the code is copy from ScopedPreferenceStore but I have open some methods in order to be
+ * available for the overload
+ *
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *
+ *******************************************************************************/
import java.io.IOException;
@@ -54,22 +55,19 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.osgi.service.prefs.BackingStoreException;
/**
-* The ScopedPreferenceStore is an IPreferenceStore that uses the scopes
-* provided in org.eclipse.core.runtime.preferences.
-* <p>
-* A ScopedPreferenceStore does the lookup of a preference based on it's search
-* scopes and sets the value of the preference based on its store scope.
-* </p>
-* <p>
-* The default scope is always included in the search scopes when searching for
-* preference values.
-* </p>
-*
-* @see org.eclipse.core.runtime.preferences
-* @since 3.1
-*/
-public class PapyrusScopedPreferenceStore extends EventManager implements
- IPreferenceStore, IPersistentPreferenceStore {
+ * The ScopedPreferenceStore is an IPreferenceStore that uses the scopes
+ * provided in org.eclipse.core.runtime.preferences.
+ * <p>
+ * A ScopedPreferenceStore does the lookup of a preference based on it's search scopes and sets the value of the preference based on its store scope.
+ * </p>
+ * <p>
+ * The default scope is always included in the search scopes when searching for preference values.
+ * </p>
+ *
+ * @see org.eclipse.core.runtime.preferences
+ * @since 3.1
+ */
+public class PapyrusScopedPreferenceStore extends EventManager implements IPreferenceStore, IPersistentPreferenceStore {
/**
* The storeContext is the context where values will stored with the
@@ -123,14 +121,13 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* ScopedPreferenceStore should call
*
* @param context
- * the scope to store to
+ * the scope to store to
* @param qualifier
- * the qualifier used to look up the preference node
+ * the qualifier used to look up the preference node
* @param defaultQualifierPath
- * the qualifier used when looking up the defaults
+ * the qualifier used when looking up the defaults
*/
- public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier,
- String defaultQualifierPath) {
+ public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
this(context, qualifier);
this.defaultQualifier = defaultQualifierPath;
}
@@ -140,17 +137,16 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* node looked up by qualifier.
*
* @param context
- * the scope to store to
+ * the scope to store to
* @param qualifier
- * the qualifer used to look up the preference node
+ * the qualifer used to look up the preference node
*/
public PapyrusScopedPreferenceStore(IScopeContext context, String qualifier) {
storeContext = context;
this.nodeQualifier = qualifier;
this.defaultQualifier = qualifier;
- ((IEclipsePreferences) getStorePreferences().parent())
- .addNodeChangeListener(getNodeChangeListener());
+ ((IEclipsePreferences)getStorePreferences().parent()).addNodeChangeListener(getNodeChangeListener());
}
/**
@@ -161,23 +157,25 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
private INodeChangeListener getNodeChangeListener() {
return new IEclipsePreferences.INodeChangeListener() {
+
/*
* (non-Javadoc)
*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
+ * @see
+ * org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences
+ * .NodeChangeEvent)
*/
public void added(NodeChangeEvent event) {
- if (nodeQualifier.equals(event.getChild().name())
- && isListenerAttached()) {
- getStorePreferences().addPreferenceChangeListener(
- preferencesListener);
+ if(nodeQualifier.equals(event.getChild().name()) && isListenerAttached()) {
+ getStorePreferences().addPreferenceChangeListener(preferencesListener);
}
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
+ * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.
+ * IEclipsePreferences.NodeChangeEvent)
*/
public void removed(NodeChangeEvent event) {
// Do nothing as there are no events from removed node
@@ -189,32 +187,33 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* Initialize the preferences listener.
*/
private void initializePreferencesListener() {
- if (preferencesListener == null) {
+ if(preferencesListener == null) {
preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
+
/*
* (non-Javadoc)
*
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
+ * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.
+ * preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
public void preferenceChange(PreferenceChangeEvent event) {
- if (silentRunning) {
+ if(silentRunning) {
return;
}
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
String key = event.getKey();
- if (newValue == null) {
+ if(newValue == null) {
newValue = getDefault(key, oldValue);
- } else if (oldValue == null) {
+ } else if(oldValue == null) {
oldValue = getDefault(key, newValue);
}
firePropertyChangeEvent(event.getKey(), oldValue, newValue);
}
};
- getStorePreferences().addPreferenceChangeListener(
- preferencesListener);
+ getStorePreferences().addPreferenceChangeListener(preferencesListener);
}
}
@@ -226,26 +225,25 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* default default value for that type is returned.
*
* @param key
- * the key to search
+ * the key to search
* @param obj
- * the object who default we are looking for
+ * the object who default we are looking for
* @return Object or <code>null</code>
*/
protected Object getDefault(String key, Object obj) {
IEclipsePreferences defaults = getDefaultPreferences();
- if (obj instanceof String) {
+ if(obj instanceof String) {
return defaults.get(key, STRING_DEFAULT_DEFAULT);
- } else if (obj instanceof Integer) {
+ } else if(obj instanceof Integer) {
return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
- } else if (obj instanceof Double) {
+ } else if(obj instanceof Double) {
return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
- } else if (obj instanceof Float) {
+ } else if(obj instanceof Float) {
return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
- } else if (obj instanceof Long) {
+ } else if(obj instanceof Long) {
return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
- } else if (obj instanceof Boolean) {
- return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
- : Boolean.FALSE;
+ } else if(obj instanceof Boolean) {
+ return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
} else {
return null;
}
@@ -285,37 +283,35 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* preference nodes based on the scope contexts for this store. If there are
* no search contexts set, then return this store's context.
* <p>
- * Whether or not the default context should be included in the resulting
- * list is specified by the <code>includeDefault</code> parameter.
+ * Whether or not the default context should be included in the resulting list is specified by the <code>includeDefault</code> parameter.
* </p>
*
* @param includeDefault
- * <code>true</code> if the default context should be included
- * and <code>false</code> otherwise
+ * <code>true</code> if the default context should be included
+ * and <code>false</code> otherwise
* @return IEclipsePreferences[]
* @since 3.4 public, was added in 3.1 as private method
*/
public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) {
// if the user didn't specify a search order, then return the scope that
// this store was created on. (and optionally the default)
- if (searchContexts == null) {
- if (includeDefault) {
- return new IEclipsePreferences[] { getStorePreferences(),
- getDefaultPreferences() };
+ if(searchContexts == null) {
+ if(includeDefault) {
+ return new IEclipsePreferences[]{ getStorePreferences(), getDefaultPreferences() };
}
- return new IEclipsePreferences[] { getStorePreferences() };
+ return new IEclipsePreferences[]{ getStorePreferences() };
}
// otherwise the user specified a search order so return the appropriate
// nodes based on it
int length = searchContexts.length;
- if (includeDefault) {
+ if(includeDefault) {
length++;
}
IEclipsePreferences[] preferences = new IEclipsePreferences[length];
- for (int i = 0; i < searchContexts.length; i++) {
+ for(int i = 0; i < searchContexts.length; i++) {
preferences[i] = searchContexts[i].getNode(nodeQualifier);
}
- if (includeDefault) {
+ if(includeDefault) {
preferences[length - 1] = getDefaultPreferences();
}
return preferences;
@@ -326,33 +322,27 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* will be done in the order of scope contexts and will not search the
* storeContext unless it is in this list.
* <p>
- * If the given list is <code>null</code>, then clear this store's search
- * contexts. This means that only this store's scope context and default
+ * If the given list is <code>null</code>, then clear this store's search contexts. This means that only this store's scope context and default
* scope will be used during preference value searching.
* </p>
* <p>
- * The defaultContext will be added to the end of this list automatically
- * and <em>MUST NOT</em> be included by the user.
+ * The defaultContext will be added to the end of this list automatically and <em>MUST NOT</em> be included by the user.
* </p>
*
* @param scopes
- * a list of scope contexts to use when searching, or
- * <code>null</code>
+ * a list of scope contexts to use when searching, or <code>null</code>
*/
public void setSearchContexts(IScopeContext[] scopes) {
this.searchContexts = scopes;
- if (scopes == null) {
+ if(scopes == null) {
return;
}
// Assert that the default was not included (we automatically add it to
// the end)
- for (int i = 0; i < scopes.length; i++) {
- if (scopes[i].equals(defaultContext)) {
- Assert
- .isTrue(
- false,
- WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError);
+ for(int i = 0; i < scopes.length; i++) {
+ if(scopes[i].equals(defaultContext)) {
+ Assert.isTrue(false, WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError);
}
}
}
@@ -363,37 +353,34 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
*/
public boolean contains(String name) {
- if (name == null) {
+ if(name == null) {
return false;
}
- return (Platform.getPreferencesService().get(name, null,
- getPreferenceNodes(true))) != null;
+ return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(true))) != null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String,
- * java.lang.Object, java.lang.Object)
+ * java.lang.Object, java.lang.Object)
*/
- public void firePropertyChangeEvent(String name, Object oldValue,
- Object newValue) {
+ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
// important: create intermediate array to protect against listeners
// being added/removed during the notification
final Object[] list = getListeners();
- if (list.length == 0) {
+ if(list.length == 0) {
return;
}
- final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
- oldValue, newValue);
- for (int i = 0; i < list.length; i++) {
- final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
- SafeRunner.run(new SafeRunnable(JFaceResources
- .getString("PreferenceStore.changeError")) { //$NON-NLS-1$
- public void run() {
- listener.propertyChange(event);
- }
- });
+ final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue);
+ for(int i = 0; i < list.length; i++) {
+ final IPropertyChangeListener listener = (IPropertyChangeListener)list[i];
+ SafeRunner.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
+
+ public void run() {
+ listener.propertyChange(event);
+ }
+ });
}
}
@@ -404,8 +391,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public boolean getBoolean(String name) {
String value = internalGet(name);
- return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
- .booleanValue();
+ return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value).booleanValue();
}
/*
@@ -414,8 +400,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
*/
public boolean getDefaultBoolean(String name) {
- return getDefaultPreferences()
- .getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
+ return getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
}
/*
@@ -470,7 +455,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public double getDouble(String name) {
String value = internalGet(name);
- if (value == null) {
+ if(value == null) {
return DOUBLE_DEFAULT_DEFAULT;
}
try {
@@ -486,12 +471,11 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* not exist then return <code>null</code>.
*
* @param key
- * the key to search with
+ * the key to search with
* @return String or <code>null</code> if the value does not exist.
*/
protected String internalGet(String key) {
- return Platform.getPreferencesService().get(key, null,
- getPreferenceNodes(true));
+ return Platform.getPreferencesService().get(key, null, getPreferenceNodes(true));
}
/*
@@ -501,7 +485,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public float getFloat(String name) {
String value = internalGet(name);
- if (value == null) {
+ if(value == null) {
return FLOAT_DEFAULT_DEFAULT;
}
try {
@@ -518,7 +502,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public int getInt(String name) {
String value = internalGet(name);
- if (value == null) {
+ if(value == null) {
return INT_DEFAULT_DEFAULT;
}
try {
@@ -535,7 +519,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public long getLong(String name) {
String value = internalGet(name);
- if (value == null) {
+ if(value == null) {
return LONG_DEFAULT_DEFAULT;
}
try {
@@ -561,11 +545,10 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
*/
public boolean isDefault(String name) {
- if (name == null) {
+ if(name == null) {
return false;
}
- return (Platform.getPreferencesService().get(name, null,
- getPreferenceNodes(false))) == null;
+ return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(false))) == null;
}
/*
@@ -581,7 +564,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String,
- * java.lang.String)
+ * java.lang.String)
*/
public void putValue(String name, String value) {
try {
@@ -602,7 +585,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
public void removePropertyChangeListener(IPropertyChangeListener listener) {
removeListenerObject(listener);
- if (!isListenerAttached()) {
+ if(!isListenerAttached()) {
disposePreferenceStoreListener();
}
}
@@ -611,7 +594,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * double)
+ * double)
*/
public void setDefault(String name, double value) {
getDefaultPreferences().putDouble(name, value);
@@ -621,7 +604,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * float)
+ * float)
*/
public void setDefault(String name, float value) {
getDefaultPreferences().putFloat(name, value);
@@ -631,7 +614,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * int)
+ * int)
*/
public void setDefault(String name, int value) {
getDefaultPreferences().putInt(name, value);
@@ -641,7 +624,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * long)
+ * long)
*/
public void setDefault(String name, long value) {
getDefaultPreferences().putLong(name, value);
@@ -651,7 +634,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * java.lang.String)
+ * java.lang.String)
*/
public void setDefault(String name, String defaultObject) {
getDefaultPreferences().put(name, defaultObject);
@@ -661,7 +644,7 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
- * boolean)
+ * boolean)
*/
public void setDefault(String name, boolean value) {
getDefaultPreferences().putBoolean(name, value);
@@ -681,11 +664,11 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
// removing a non-existing preference is a no-op so call the Core
// API directly
getStorePreferences().remove(name);
- if (oldValue != defaultValue){
+ if(oldValue != defaultValue) {
dirty = true;
firePropertyChangeEvent(name, oldValue, defaultValue);
}
-
+
} finally {
silentRunning = false;// Restart listening to preferences
}
@@ -696,23 +679,22 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * double)
+ * double)
*/
public void setValue(String name, double value) {
double oldValue = getDouble(name);
- if (oldValue == value) {
+ if(oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
- if (getDefaultDouble(name) == value) {
+ if(getDefaultDouble(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putDouble(name, value);
}
dirty = true;
- firePropertyChangeEvent(name, new Double(oldValue), new Double(
- value));
+ firePropertyChangeEvent(name, new Double(oldValue), new Double(value));
} finally {
silentRunning = false;// Restart listening to preferences
}
@@ -722,16 +704,16 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * float)
+ * float)
*/
public void setValue(String name, float value) {
float oldValue = getFloat(name);
- if (oldValue == value) {
+ if(oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
- if (getDefaultFloat(name) == value) {
+ if(getDefaultFloat(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putFloat(name, value);
@@ -747,23 +729,22 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * int)
+ * int)
*/
public void setValue(String name, int value) {
int oldValue = getInt(name);
- if (oldValue == value) {
+ if(oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
- if (getDefaultInt(name) == value) {
+ if(getDefaultInt(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putInt(name, value);
}
dirty = true;
- firePropertyChangeEvent(name, new Integer(oldValue), new Integer(
- value));
+ firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value));
} finally {
silentRunning = false;// Restart listening to preferences
}
@@ -773,16 +754,16 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * long)
+ * long)
*/
public void setValue(String name, long value) {
long oldValue = getLong(name);
- if (oldValue == value) {
+ if(oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
- if (getDefaultLong(name) == value) {
+ if(getDefaultLong(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putLong(name, value);
@@ -798,11 +779,11 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * java.lang.String)
+ * java.lang.String)
*/
public void setValue(String name, String value) {
// Do not turn on silent running here as Strings are propagated
- if (getDefaultString(name).equals(value)) {
+ if(getDefaultString(name).equals(value)) {
getStorePreferences().remove(name);
} else {
getStorePreferences().put(name, value);
@@ -814,23 +795,22 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
- * boolean)
+ * boolean)
*/
public void setValue(String name, boolean value) {
boolean oldValue = getBoolean(name);
- if (oldValue == value) {
+ if(oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
- if (getDefaultBoolean(name) == value) {
+ if(getDefaultBoolean(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putBoolean(name, value);
}
dirty = true;
- firePropertyChangeEvent(name, oldValue ? Boolean.TRUE
- : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
+ firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
} finally {
silentRunning = false;// Restart listening to preferences
}
@@ -856,11 +836,9 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
*/
private void disposePreferenceStoreListener() {
- IEclipsePreferences root = (IEclipsePreferences) Platform
- .getPreferencesService().getRootNode().node(
- Plugin.PLUGIN_PREFERENCE_SCOPE);
+ IEclipsePreferences root = (IEclipsePreferences)Platform.getPreferencesService().getRootNode().node(Plugin.PLUGIN_PREFERENCE_SCOPE);
try {
- if (!(root.nodeExists(nodeQualifier))) {
+ if(!(root.nodeExists(nodeQualifier))) {
return;
}
} catch (BackingStoreException e) {
@@ -869,10 +847,10 @@ public class PapyrusScopedPreferenceStore extends EventManager implements
}
IEclipsePreferences preferences = getStorePreferences();
- if (preferences == null) {
+ if(preferences == null) {
return;
}
- if (preferencesListener != null) {
+ if(preferencesListener != null) {
preferences.removePreferenceChangeListener(preferencesListener);
preferencesListener = null;
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/ColorFieldEditor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/ColorFieldEditor.java
index c1588adcb00..d7497590835 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/ColorFieldEditor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/ColorFieldEditor.java
@@ -69,8 +69,7 @@ public class ColorFieldEditor extends FieldEditor {
public void load() {
super.load();
- buttonImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), PreferenceConverter.getColor(
- getPreferenceStore(), getPreferenceName())).createImage();
+ buttonImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName())).createImage();
colorButton.setImage(buttonImage);
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/FontFieldEditor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/FontFieldEditor.java
index e49f7b29454..d3042e0a222 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/FontFieldEditor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/FontFieldEditor.java
@@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.Composite;
* <li>Bold</li>
* <li>Italic</li>
* </ul>
- *This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection
+ * This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection
* <em>ColorsAndFontsPropertySection</em>}
*
* @author tlandre
@@ -56,8 +56,7 @@ public class FontFieldEditor extends FieldEditor {
/** properties */
// @unused
- protected static final String FONT_COMMAND_NAME = DiagramUIPropertiesMessages.Font_commandText
- + StringStatics.SPACE + VALUE_CHANGED_STRING;
+ protected static final String FONT_COMMAND_NAME = DiagramUIPropertiesMessages.Font_commandText + StringStatics.SPACE + VALUE_CHANGED_STRING;
// @unused
protected static final String FONTS_AND_COLORS_LABEL = DiagramUIPropertiesMessages.FontAndColor_nameLabel;
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/GradientFieldEditor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/GradientFieldEditor.java
index 3553734e69a..bfbc315f3e2 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/GradientFieldEditor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/GradientFieldEditor.java
@@ -68,11 +68,15 @@ public class GradientFieldEditor extends FieldEditor {
private int transparency = 0;
private int style = GradientStyle.HORIZONTAL;
-/**
- * create a field to display gradient preference
- * @param gradientPreferenceName the name of the gradient field
- * @param parent the parent composite
- */
+
+ /**
+ * create a field to display gradient preference
+ *
+ * @param gradientPreferenceName
+ * the name of the gradient field
+ * @param parent
+ * the parent composite
+ */
public GradientFieldEditor(String gradientPreferenceName, Composite parent) {
super(gradientPreferenceName, "", parent); //$NON-NLS-1$
}
@@ -180,8 +184,7 @@ public class GradientFieldEditor extends FieldEditor {
@Override
protected void doStore() {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(color1, color2,
- style, transparency);
+ GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(color1, color2, style, transparency);
getPreferenceStore().setValue(getPreferenceName(), gradientPreferenceConverter.getPreferenceValue());
}
@@ -252,8 +255,7 @@ public class GradientFieldEditor extends FieldEditor {
* @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup
*/
private RGB changeColor() {
- ColorPalettePopup popup = new ColorPalettePopup(colorButton.getParent().getShell(),
- IDialogConstants.BUTTON_BAR_HEIGHT);
+ ColorPalettePopup popup = new ColorPalettePopup(colorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
Rectangle r = colorButton.getBounds();
Point location = colorButton.getParent().toDisplay(r.x, r.y);
popup.open(new Point(location.x, location.y + r.height));
@@ -264,12 +266,14 @@ public class GradientFieldEditor extends FieldEditor {
setButtonImage(rgb);
return rgb;
}
-
+
/**
* used to set disable this field editor
- * @param enabled a boolean, ture to edit the field
+ *
+ * @param enabled
+ * a boolean, ture to edit the field
*/
- public void setEnabled(boolean enabled){
+ public void setEnabled(boolean enabled) {
colorButton.setEnabled(enabled);
horizontalStyleButton.setEnabled(enabled);
transparencyValueSpinner.setEnabled(enabled);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java
index fb9c4002680..e89e9dfd0c7 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java
@@ -56,8 +56,7 @@ public class GradientTransparencySelectionDialog extends GradientSelectionDialog
* the transparency of the gradient. It is ignored if not within [0, 100] range
*/
// @unused
- public GradientTransparencySelectionDialog(Shell parent, int style, RGB initColor1, RGB initColor2,
- int defaultGradientStyle, int transparency) {
+ public GradientTransparencySelectionDialog(Shell parent, int style, RGB initColor1, RGB initColor2, int defaultGradientStyle, int transparency) {
super(parent, style, initColor1, initColor2, defaultGradientStyle, transparency);
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/messages.properties b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/messages.properties
index 8d346075df6..5372bd6a1de 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/messages.properties
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/messages.properties
@@ -32,3 +32,4 @@ GradientFieldEditor_Transparency=Transparency
GradientFieldEditor_Vertical=Vertical
DecorationGroup_Name=Decoration
DimensionGroupName=Dimension
+NodeCompartmentGroup_Compartiments=Show/hide compartments
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusNodePreferencePage.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusNodePreferencePage.java
index af919d7b2c2..ce5b92e2bc0 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusNodePreferencePage.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusNodePreferencePage.java
@@ -8,13 +8,17 @@
*
* Contributors:
* Thibault Landre (Atos Origin) - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) - Add a list for the compartment names
*****************************************************************************/
package org.eclipse.papyrus.preferences.pages;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.papyrus.preferences.ui.BackgroundColor;
import org.eclipse.papyrus.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.preferences.ui.NodeColorGroup;
+import org.eclipse.papyrus.preferences.ui.NodeCompartmentGroup;
import org.eclipse.swt.widgets.Composite;
/**
@@ -27,6 +31,25 @@ import org.eclipse.swt.widgets.Composite;
*/
public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusElementPreferencePage {
+ /** the list owning the compartment names for the Node */
+ protected List<String> compartmentsList;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public AbstractPapyrusNodePreferencePage() {
+ compartmentsList = new ArrayList<String>();
+ initializeCompartmentsList();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.preferences.pages.AbstractPapyrusElementPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ */
@Override
protected void createPageContents(Composite parent) {
super.createPageContents(parent);
@@ -34,9 +57,19 @@ public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusE
addAbstractGroup(colorGroupForNodeComposite);
BackgroundColor backgroundColorGroup = new BackgroundColor(parent, getPreferenceKey(), this);
addAbstractGroup(backgroundColorGroup);
- DecorationGroup decorationGroup= new DecorationGroup(parent, getPreferenceKey(), this);
+ DecorationGroup decorationGroup = new DecorationGroup(parent, getPreferenceKey(), this);
addAbstractGroup(decorationGroup);
+ if(!compartmentsList.isEmpty()) {
+ NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getPreferenceStore());
+ addAbstractGroup(compartmentGroup);
+ }
+ }
+
+ /**
+ * Initialize {@link #compartmentsList} with the name of the compartment owned by the node
+ */
+ protected void initializeCompartmentsList() {
+ // TODO Auto-generated method stub
}
-
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusPreferencePage.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusPreferencePage.java
index 11e2943befb..24da4bf1bd8 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusPreferencePage.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/AbstractPapyrusPreferencePage.java
@@ -50,8 +50,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
* </ul>
* </p>
*/
-public abstract class AbstractPapyrusPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
-IWorkbenchPropertyPage {
+public abstract class AbstractPapyrusPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IWorkbenchPropertyPage {
private IProject project;
@@ -65,16 +64,19 @@ IWorkbenchPropertyPage {
public IAdaptable getElement() {
return project;
}
- protected void setPreferenceKey(String aKey){
- this.key=aKey;
+
+ protected void setPreferenceKey(String aKey) {
+ this.key = aKey;
}
- protected String getPreferenceKey(){
+
+ protected String getPreferenceKey() {
return this.key;
}
public IPreferenceStore getPreferenceStore() {
return Activator.getDefault().getPreferenceStore();
}
+
/**
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
*/
@@ -154,6 +156,7 @@ IWorkbenchPropertyPage {
VisiblePageSingleton.getInstance().store();
return super.performOk();
}
+
/**
* Stores the values of the fields contained in this page into the preference store.
*/
@@ -164,6 +167,7 @@ IWorkbenchPropertyPage {
}
}
}
+
/**
* Store all preferences
*/
@@ -171,6 +175,7 @@ IWorkbenchPropertyPage {
storePreferences();
}
+
/*
* (non-Javadoc)
*
@@ -216,16 +221,18 @@ IWorkbenchPropertyPage {
}
+
@Override
public void setVisible(boolean visible) {
// TODO Auto-generated method stub
- if(visible==true){
+ if(visible == true) {
VisiblePageSingleton.getInstance().setVisiblePage(this);
initGroup();
}
super.setVisible(visible);
}
+
/**
* The bundle ID used to defined the preference store
*
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/DiagramPreferencePage.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/DiagramPreferencePage.java
index 9bc33c2ed4a..0f81fb6c39f 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/DiagramPreferencePage.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/DiagramPreferencePage.java
@@ -49,11 +49,13 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
private Set<AbstractGroup> groupSet;
- public void createControl(Composite parent){
+ public void createControl(Composite parent) {
super.createControl(parent);
initGroup();
}
- private String key=null;
+
+ private String key = null;
+
@Override
protected Control createContents(Composite parent) {
Group contentGroup = new Group(parent, 2);
@@ -72,16 +74,18 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
addAbstractGroup(connectionGroupComposite);
//background
- BackgroundColor backgroundColorGroup = new DiagramBackgroundColor(contentGroup,getPreferenceKey(), this);
+ BackgroundColor backgroundColorGroup = new DiagramBackgroundColor(contentGroup, getPreferenceKey(), this);
addAbstractGroup(backgroundColorGroup);
DecorationGroup decorationGroupComposite = new DiagramDecorationGroup(contentGroup, getPreferenceKey(), this);
addAbstractGroup(decorationGroupComposite);
return super.createContents(parent);
}
- protected String getPreferenceKey(){
+
+ protected String getPreferenceKey() {
return this.key;
}
+
/**
* Init groups contained in this page.
*/
@@ -93,10 +97,12 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
}
}
}
+
public boolean performOk() {
VisiblePageSingleton.getInstance().store();
return super.performOk();
}
+
/**
* Stores the values of the fields contained in this page into the preference store.
*/
@@ -106,8 +112,9 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
gs.storePreferences();
}
}
-
+
}
+
/**
* store all preferences
*/
@@ -117,9 +124,10 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
}
- protected void setPreferenceKey(String aKey){
- this.key=aKey;
+ protected void setPreferenceKey(String aKey) {
+ this.key = aKey;
}
+
@Override
public void dispose() {
super.dispose();
@@ -131,6 +139,7 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
}
+
/**
* Add the given field editor to the page.
*/
@@ -140,6 +149,7 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
}
groupSet.add(fe);
}
+
/**
* Load the default preferences of the fields contained in this page
*/
@@ -151,6 +161,7 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
}
}
+
/*
* (non-Javadoc)
*
@@ -160,12 +171,14 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
loadDefaultPreferences();
super.performDefaults();
}
+
@Override
public void setVisible(boolean visible) {
// TODO Auto-generated method stub
- if(visible==true){
+ if(visible == true) {
VisiblePageSingleton.getInstance().setVisiblePage(this);
- initGroup();}
+ initGroup();
+ }
super.setVisible(visible);
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/PapyrusAllDiagramsPreferencePage.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/PapyrusAllDiagramsPreferencePage.java
index 81696e2b35b..99947d653f2 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/PapyrusAllDiagramsPreferencePage.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/PapyrusAllDiagramsPreferencePage.java
@@ -56,31 +56,31 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
protected void createPageContents(Composite parent) {
Group contentGroup = new Group(parent, 2);
contentGroup.setLayout(new GridLayout(4, false));
-
+
//FontGroup
FontGroup fontGroupComposite = new EditorFontGroup(contentGroup, getTitle(), this);
addAbstractGroup(fontGroupComposite);
//color
NodeColorGroup colorGroupForNodeComposite = new EditorNodeColorGroup(contentGroup, getTitle(), this);
addAbstractGroup(colorGroupForNodeComposite);
-
+
// router for links
ConnectionGroup connectionGroupComposite = new EditorConnectionGroup(contentGroup, getTitle(), this);
addAbstractGroup(connectionGroupComposite);
-
+
//background
BackgroundColor backgroundColorGroup = new EditorBackgroundColor(contentGroup, getTitle(), this);
addAbstractGroup(backgroundColorGroup);
-
+
DecorationGroup decorationGroupComposite = new EditorDecorationGroup(contentGroup, getTitle(), this);
addAbstractGroup(decorationGroupComposite);
-
+
DimensionGroup dimensionGroup = new EditorDimensionGroup(contentGroup, getTitle(), this);
addAbstractGroup(dimensionGroup);
}
-
+
@Override
protected String getBundleId() {
return Activator.PLUGIN_ID;
@@ -88,39 +88,41 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
/**
* use to init default preferences at the papyrus level
- * @param store the preference store
+ *
+ * @param store
+ * the preference store
*/
public static void initDefaults(IPreferenceStore store) {
-
+
//Nodes
- PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
+ PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
+ PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
// Set the default for the gradient
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.GRADIENT_POLICY), false);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.GRADIENT_POLICY), false);
GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(new org.eclipse.swt.graphics.RGB(255, 255, 255), new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
// Links
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.SMOOTHNESS), Smoothness.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.JUMPLINK_STATUS), JumpLinkStatus.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.JUMPLINK_TYPE), JumpLinkStatus.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.JUMPLINK_REVERSE),false );
-
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.ROUTING_STYLE), Routing.MANUAL );
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.ROUTING_POLICY_DISTANCE), false);
-
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.SMOOTHNESS), Smoothness.NONE);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_STATUS), JumpLinkStatus.NONE);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_TYPE), JumpLinkStatus.NONE);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_REVERSE), false);
+
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_STYLE), Routing.MANUAL);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION), false);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_POLICY_DISTANCE), false);
+
//decoration
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.SHADOW), false );
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.ELEMENTICON), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.QUALIFIEDNAME), false);
- //dimension
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.WIDTH), 100 );
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant( PreferenceConstantHelper.HEIGHT), 100);
-
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.SHADOW), false);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ELEMENTICON), false);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.QUALIFIEDNAME), false);
+ //dimension
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.WIDTH), 100);
+ store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.HEIGHT), 100);
+
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/internal/VisiblePageSingleton.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/internal/VisiblePageSingleton.java
index a0ece6854b9..5253a2fbe55 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/internal/VisiblePageSingleton.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/pages/internal/VisiblePageSingleton.java
@@ -16,53 +16,60 @@ package org.eclipse.papyrus.preferences.pages.internal;
import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.papyrus.preferences.pages.AbstractPapyrusPreferencePage;
import org.eclipse.papyrus.preferences.pages.DiagramPreferencePage;
+
/**
* This singleton has bee created to manage the button ok and apply of preference page.
* In the case of button ok pressed, the behavior of eclipse try of apply in the first preference page found.
- * Here each page has a specific behavior. So to store the preference, the active page is called
- *
+ * Here each page has a specific behavior. So to store the preference, the active page is called
+ *
*/
public class VisiblePageSingleton {
private static VisiblePageSingleton instance;
+
private IPreferencePage page;
/**
*
* @return the instance of the {@link VisiblePageSingleton}
*/
- public static VisiblePageSingleton getInstance() {
- if( instance==null){
- instance=new VisiblePageSingleton();
+ public static VisiblePageSingleton getInstance() {
+ if(instance == null) {
+ instance = new VisiblePageSingleton();
}
return instance;
}
/**
* set the visible page
- * @param page a {@link IPreferencePage} --> {@link DiagramPreferencePage} or {@link AbstractPapyrusPreferencePage}
+ *
+ * @param page
+ * a {@link IPreferencePage} --> {@link DiagramPreferencePage} or {@link AbstractPapyrusPreferencePage}
*/
- public void setVisiblePage(IPreferencePage page){
- this.page= page;
+ public void setVisiblePage(IPreferencePage page) {
+ this.page = page;
}
+
/**
*
* @return the Visible Page
*/
- public IPreferencePage getVisiblePage(){
+ public IPreferencePage getVisiblePage() {
return this.page;
}
+
/**
* call the visisble page in order to store preferences
*/
- public void store(){
- if( this.page!=null){
- if( this.page instanceof DiagramPreferencePage){
+ public void store() {
+ if(this.page != null) {
+ if(this.page instanceof DiagramPreferencePage) {
((DiagramPreferencePage)(this.page)).storeAllPreferences();
}
- if( this.page instanceof AbstractPapyrusPreferencePage){
+ if(this.page instanceof AbstractPapyrusPreferencePage) {
((AbstractPapyrusPreferencePage)(this.page)).storeAllPreferences();
}
}
- }}
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/AbstractGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/AbstractGroup.java
index e5d2a67ac28..e2f50523842 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/AbstractGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/AbstractGroup.java
@@ -131,7 +131,7 @@ public abstract class AbstractGroup extends Composite {
*
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#addFieldEditor(FieldEditor)
*/
- public void load() {
+ public void load() {
for(FieldEditor fe : fieldsEditor) {
fe.load();
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/BackgroundColor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/BackgroundColor.java
index 7ebf88d6134..d55cf58de67 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/BackgroundColor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/BackgroundColor.java
@@ -77,23 +77,22 @@ public class BackgroundColor extends AbstractGroup {
Composite useGradientFillEditorCompo = getEncapsulatedCompo(useGradientCompo);
useGradientFillEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.GRADIENT_POLICY), "", useGradientFillEditorCompo); //$NON-NLS-1$
useGradientFillEditor.setPage(dialogPage);
-
+
addFieldEditor(useGradientFillEditor);
- Composite gradientFillEditorCompo = getEncapsulatedCompo(fillColorGroup);
- gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_GRADIENT),
- gradientFillEditorCompo);
+ Composite gradientFillEditorCompo = getEncapsulatedCompo(fillColorGroup);
+ gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_GRADIENT), gradientFillEditorCompo);
gradientFillEditor.setPage(dialogPage);
gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
addFieldEditor(gradientFillEditor);
useGradientFillEditor.setPropertyChangeListener(new IPropertyChangeListener() {
-
+
public void propertyChange(PropertyChangeEvent event) {
-
- gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
-
-
+
+ gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
+
+
}
});
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/ConnectionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/ConnectionGroup.java
index af3850ecdc4..d9012cd5365 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/ConnectionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/ConnectionGroup.java
@@ -67,24 +67,20 @@ public class ConnectionGroup extends AbstractGroup {
private static final String ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_ClosestDistance;
/** The Constant SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES = {
- { Messages.AbstractPapyrusLinkPreferencePage_None, "" + Smoothness.NONE }, //$NON-NLS-2$
+ private static final String[][] SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + Smoothness.NONE }, //$NON-NLS-2$
{ Messages.AbstractPapyrusLinkPreferencePage_Less, "" + Smoothness.LESS }, { Messages.AbstractPapyrusLinkPreferencePage_Normal, "" + Smoothness.NORMAL }, { Messages.AbstractPapyrusLinkPreferencePage_More, "" + Smoothness.MORE } }; //$NON-NLS-2$ //$NON-NLS-4$ //$NON-NLS-6$
/** The Constant JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES = {
- { Messages.AbstractPapyrusLinkPreferencePage_None, "" + JumpLinkStatus.NONE }, { Messages.AbstractPapyrusLinkPreferencePage_Below, "" + JumpLinkStatus.BELOW }, //$NON-NLS-2$ //$NON-NLS-4$
+ private static final String[][] JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + JumpLinkStatus.NONE }, { Messages.AbstractPapyrusLinkPreferencePage_Below, "" + JumpLinkStatus.BELOW }, //$NON-NLS-2$ //$NON-NLS-4$
{ Messages.AbstractPapyrusLinkPreferencePage_All, "" + JumpLinkStatus.ALL }, { Messages.AbstractPapyrusLinkPreferencePage_Above, "" + JumpLinkStatus.ABOVE } }; //$NON-NLS-2$ //$NON-NLS-4$
/** The Constant JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES = {
- { Messages.AbstractPapyrusLinkPreferencePage_SemiCircle, "" + JumpLinkType.SEMICIRCLE }, { Messages.AbstractPapyrusLinkPreferencePage_Square, "" + JumpLinkType.SQUARE }, //$NON-NLS-2$ //$NON-NLS-4$
+ private static final String[][] JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_SemiCircle, "" + JumpLinkType.SEMICIRCLE }, { Messages.AbstractPapyrusLinkPreferencePage_Square, "" + JumpLinkType.SQUARE }, //$NON-NLS-2$ //$NON-NLS-4$
{ Messages.AbstractPapyrusLinkPreferencePage_Chamfered, "" + JumpLinkType.CHAMFERED } }; //$NON-NLS-2$
// TODO : check if Tree is always a valid possibility
/** The Constant ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES = {
- { Messages.AbstractPapyrusLinkPreferencePage_Oblique, "" + Routing.MANUAL }, { Messages.AbstractPapyrusLinkPreferencePage_Rectilinear, "" + Routing.RECTILINEAR }, //$NON-NLS-2$ //$NON-NLS-4$
+ private static final String[][] ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_Oblique, "" + Routing.MANUAL }, { Messages.AbstractPapyrusLinkPreferencePage_Rectilinear, "" + Routing.RECTILINEAR }, //$NON-NLS-2$ //$NON-NLS-4$
{ Messages.AbstractPapyrusLinkPreferencePage_Tree, "" + Routing.TREE } }; //$NON-NLS-2$
/** The routing styles combo field editor. */
@@ -116,10 +112,7 @@ public class ConnectionGroup extends AbstractGroup {
connectionGroup.setLayout(new GridLayout());
connectionGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Connection);
- ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.SMOOTHNESS),
- Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES,
- connectionGroup);
+ ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.SMOOTHNESS), Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES, connectionGroup);
addFieldEditor(smoothnessComboFieldEditor);
@@ -139,24 +132,17 @@ public class ConnectionGroup extends AbstractGroup {
jumpLinkGroup.setLayout(new GridLayout());
jumpLinkGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_JUMPLINKS);
- jumpLinkStatusComboFieldEditor = new ComboFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_STATUS),
- JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES,
- jumpLinkGroup);
+ jumpLinkStatusComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_STATUS), JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
jumpLinkStatusComboFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkStatusComboFieldEditor);
- jumpLinkTypeComboFieldEditor = new ComboFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL,
- JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
+ jumpLinkTypeComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL, JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
jumpLinkTypeComboFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkTypeComboFieldEditor);
- jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_REVERSE),
- JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup);
+ jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_REVERSE), JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup);
jumpLinkReverseBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkReverseBooleanFieldEditor);
@@ -173,23 +159,17 @@ public class ConnectionGroup extends AbstractGroup {
routingGroup.setLayout(new GridLayout());
routingGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Routing);
- routingStylesComboFieldEditor = new ComboFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL,
- ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup);
+ routingStylesComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL, ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup);
routingStylesComboFieldEditor.setPage(dialogPage);
addFieldEditor(routingStylesComboFieldEditor);
- routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION),
- ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
+ routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION), ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
routingObstructionPolicyBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(routingObstructionPolicyBooleanFieldEditor);
- routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_DISTANCE),
- ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
+ routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_DISTANCE), ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
routingDistancePolicyBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(routingDistancePolicyBooleanFieldEditor);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DecorationGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DecorationGroup.java
index 4121aa8e5df..b65d6a5d503 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DecorationGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DecorationGroup.java
@@ -26,36 +26,40 @@ import org.eclipse.swt.widgets.Group;
* The Class DecorationGroup that display field for shadow, element icon, and qualified name
*/
public class DecorationGroup extends AbstractGroup {
-
+
/** The Constant SHADOW_BOOLEANFIELDEDITOR_LABEL. */
protected static final String SHADOW_BOOLEANFIELDEDITOR_LABEL = "Shadow";
-
+
/** The Constant ELEMENTICON_BOOLEANFIELDEDITOR_LABEL. */
private static final String ELEMENTICON_BOOLEANFIELDEDITOR_LABEL = "Element icon";
-
+
/** The Constant QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL. */
private static final String QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL = "Qualified name";
-
+
/** The shadow fied editor. */
protected BooleanFieldEditor shadowFiedEditor;
-
+
/** The element icon. */
protected BooleanFieldEditor elementIcon;
-
+
/** The qualifiedname. */
protected BooleanFieldEditor qualifiedname;
/**
* Instantiates a new decoration group.
*
- * @param parent the parent
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
public DecorationGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
createContent(parent);
}
+
/**
* Creates the content.
*
@@ -67,22 +71,16 @@ public class DecorationGroup extends AbstractGroup {
decorationGroup.setLayout(new GridLayout());
decorationGroup.setText(Messages.DecorationGroup_Name);
- shadowFiedEditor = new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.SHADOW),
- SHADOW_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
+ shadowFiedEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.SHADOW), SHADOW_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
shadowFiedEditor.setPage(dialogPage);
addFieldEditor(shadowFiedEditor);
-
- elementIcon= new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.ELEMENTICON),
- ELEMENTICON_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
+
+ elementIcon = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ELEMENTICON), ELEMENTICON_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
elementIcon.setPage(dialogPage);
addFieldEditor(elementIcon);
-
- qualifiedname= new BooleanFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.QUALIFIEDNAME),
- QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
+
+ qualifiedname = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.QUALIFIEDNAME), QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
qualifiedname.setPage(dialogPage);
addFieldEditor(qualifiedname);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DimensionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DimensionGroup.java
index c4a7a41e178..bcd44f589b9 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DimensionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/DimensionGroup.java
@@ -30,27 +30,31 @@ public class DimensionGroup extends AbstractGroup {
/** The Constant HEIGHT_INTFIELDEDITOR_LABEL. */
private static final String HEIGHT_INTFIELDEDITOR_LABEL = "height";
-
+
/** The Constant WIDTH_INTFIELDEDITOR_LABEL. */
private static final String WIDTH_INTFIELDEDITOR_LABEL = "width";
-
+
/** The width fied editor. */
protected IntegerFieldEditor widthFiedEditor;
-
+
/** The height fied editor. */
protected IntegerFieldEditor heightFiedEditor;
-
+
/**
* Instantiates a new dimension group.
*
- * @param parent the parent
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
public DimensionGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
createContent(parent);
}
+
/**
* Creates the content.
*
@@ -62,16 +66,12 @@ public class DimensionGroup extends AbstractGroup {
decorationGroup.setLayout(new GridLayout());
decorationGroup.setText(Messages.DimensionGroupName);
- widthFiedEditor = new IntegerFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.WIDTH),
- WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
+ widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
widthFiedEditor.setPage(dialogPage);
addFieldEditor(widthFiedEditor);
-
- heightFiedEditor = new IntegerFieldEditor(
- getPreferenceConstant(PreferenceConstantHelper.HEIGHT),
- HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
+
+ heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
heightFiedEditor.setPage(dialogPage);
addFieldEditor(heightFiedEditor);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/LinkColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/LinkColorGroup.java
index 515f15f3830..89b9cedcc83 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/LinkColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/LinkColorGroup.java
@@ -75,15 +75,13 @@ public class LinkColorGroup extends AbstractGroup {
toolbar.setLayout(new GridLayout(3, false));
Composite fontColorEditorCompo = getEncapsulatedCompo(toolbar);
- fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FONT),
- DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo);
+ fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FONT), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo);
fontColorEditor.setPage(dialogPage);
addFieldEditor(fontColorEditor);
Composite lineColorEditorCompo = getEncapsulatedCompo(toolbar);
- lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_LINE),
- DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo);
+ lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_LINE), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo);
lineColorEditor.setPage(dialogPage);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeColorGroup.java
index bd6f19d8c01..aa4f25a0d1e 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeColorGroup.java
@@ -59,8 +59,7 @@ public class NodeColorGroup extends LinkColorGroup {
super.createContent(parent);
Composite fillColorEditorCompo = getEncapsulatedCompo(getToolbar());
- fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FILL),
- DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo);
+ fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FILL), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo);
fillColorEditor.setPage(dialogPage);
addFieldEditor(fillColorEditor);
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeCompartmentGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeCompartmentGroup.java
new file mode 100644
index 00000000000..ce8215c9a15
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/NodeCompartmentGroup.java
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (c) 2009-2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Tatiana Fesenko (CEA LIST) - Bug 330772 - [Usability] Allow to configure visibility of name of compartments in the preferences pages
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.preferences.ui;
+
+import java.util.List;
+
+import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.swt.SWT;
+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.Group;
+
+/**
+ * The Class NodeCompartmentGroup contains field editor to manage the display of the compartment
+ */
+public class NodeCompartmentGroup extends AbstractGroup {
+
+ /** the list owning the compartment names for the UML element */
+ private final List<String> myCompartments;
+
+ private final IPreferenceStore myPreferenceStore;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param title
+ * @param dialogPage
+ * @param compartmentsName
+ */
+ public NodeCompartmentGroup(Composite parent, String title, DialogPage dialogPage, List<String> compartmentsName, IPreferenceStore store) {
+ super(parent, title, dialogPage);
+ this.myCompartments = compartmentsName;
+ myPreferenceStore = store;
+ createContent(parent);
+ }
+
+ /**
+ * create the content.
+ *
+ * @param parent
+ * : the parent composite
+ */
+ protected void createContent(Composite parent) {
+ for(String compartment : myCompartments) {
+ addCompartmentVisibilityGroup(parent, compartment);
+ }
+ }
+
+ private void addCompartmentVisibilityGroup(Composite parent, String compartment) {
+ // show Compartment Visibility and CompartmentName Visibility items in the same row
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout(2, true));
+ group.setText(compartment);
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 2;
+ group.setLayoutData(gridData);
+
+ String compartmentVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartment, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ String compartmentVisibilityLabel = "Show compartment";
+ Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel);
+
+ String compartmentNameVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartment, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ String compartmentNameVisibilityLabel = "Show title";
+ Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel);
+
+ boolean showCompartmentIsNotChecked = !myPreferenceStore.getBoolean(compartmentVisibilityPreference);
+ if(showCompartmentIsNotChecked) {
+ showNameButton.setEnabled(false);
+ }
+
+ createDependency(showCompartmentButton, new Control[]{ showNameButton });
+ }
+
+
+ private Button addCheckboxField(Composite parent, String preferenceKey, String label) {
+ // show Compartment Visibility and CompartmentName Visibility items in the same row
+ // as CheckBoxFieldEditor resets layout data to fit the grid we create this stub plate
+ // @see #doFillIntoGrid
+ Composite plate = new Composite(parent, SWT.NONE);
+ plate.setLayoutData(new GridData());
+
+ CheckBoxFieldEditor compartmentVisibilityBooleanFieldEditor = new CheckBoxFieldEditor(preferenceKey, label, plate);
+ Button checkbox = compartmentVisibilityBooleanFieldEditor.getCheckbox();
+ compartmentVisibilityBooleanFieldEditor.setPage(getDialogPage());
+ addFieldEditor(compartmentVisibilityBooleanFieldEditor);
+ return checkbox;
+ }
+
+ private void createDependency(final Button master, final Control[] slaves) {
+ SelectionListener dependencyListener = new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ boolean state = master.getSelection();
+ for(int i = 0; i < slaves.length; i++) {
+ slaves[i].setEnabled(state);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ };
+ master.addSelectionListener(dependencyListener);
+ }
+
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramBackgroundColor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramBackgroundColor.java
index cec051cd54c..fbb6f89249b 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramBackgroundColor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramBackgroundColor.java
@@ -17,20 +17,23 @@ import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.papyrus.preferences.ui.BackgroundColor;
import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
+
/**
- * this class is a background group specialized for the level diagram
- *
+ * this class is a background group specialized for the level diagram
+ *
*/
public class DiagramBackgroundColor extends BackgroundColor {
/**
* constructor
- * @param parent the composite patent
- * @param key the preference key the kind of diagram
+ *
+ * @param parent
+ * the composite patent
+ * @param key
+ * the preference key the kind of diagram
* @param dialogPage
*/
- public DiagramBackgroundColor(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramBackgroundColor(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramConnectionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramConnectionGroup.java
index 5605bd3af96..092e0ccf813 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramConnectionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramConnectionGroup.java
@@ -20,21 +20,24 @@ import org.eclipse.swt.widgets.Composite;
/**
* this clas is a specialiezation of the connection for the diagram level
- *
+ *
*/
public class DiagramConnectionGroup extends ConnectionGroup {
/**
* constructor
- * @param parent the composite parent
- * @param key the preference key the kind of diagram
+ *
+ * @param parent
+ * the composite parent
+ * @param key
+ * the preference key the kind of diagram
* @param dialogPage
*/
- public DiagramConnectionGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramConnectionGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
// TODO Auto-generated constructor stub
}
+
protected String getPreferenceConstant(int preferenceType) {
return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDecorationGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDecorationGroup.java
index 4f5b9bdfd86..bb9ae473b81 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDecorationGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDecorationGroup.java
@@ -27,16 +27,20 @@ public class DiagramDecorationGroup extends DecorationGroup {
/**
* Instantiates a new diagram decoration group.
*
- * @param parent the parent
- * @param key the prefix preference key the kind of diagram
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent
+ * @param key
+ * the prefix preference key the kind of diagram
+ * @param dialogPage
+ * the dialog page
*/
- public DiagramDecorationGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramDecorationGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDimensionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDimensionGroup.java
index 512606e47ee..a1f9886ae1b 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDimensionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramDimensionGroup.java
@@ -22,20 +22,24 @@ import org.eclipse.swt.widgets.Composite;
* The Class DiagramDimensionGroup specialized at the level diagra
*/
public class DiagramDimensionGroup extends DimensionGroup {
-
+
/**
* Instantiates a new diagram dimension group.
*
- * @param parent the composite parent
- * @param key the key the kind of the diagram
- * @param dialogPage the dialog page
+ * @param parent
+ * the composite parent
+ * @param key
+ * the key the kind of the diagram
+ * @param dialogPage
+ * the dialog page
*/
- public DiagramDimensionGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramDimensionGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramFontGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramFontGroup.java
index ca6a5ae6717..5fb1fa0998c 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramFontGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramFontGroup.java
@@ -26,15 +26,20 @@ public class DiagramFontGroup extends FontGroup {
/**
* Instantiates a new diagram font group.
*
- * @param parent the parent composite
- * @param key the kind of the diagram
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the kind of the diagram
+ * @param dialogPage
+ * the dialog page
*/
public DiagramFontGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramLinkColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramLinkColorGroup.java
index 568079fed74..2de215efe4c 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramLinkColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramLinkColorGroup.java
@@ -26,16 +26,20 @@ public class DiagramLinkColorGroup extends LinkColorGroup {
/**
* Instantiates a new diagram link color group.
*
- * @param parent the parent composite
- * @param key the tkind of the diagram
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the tkind of the diagram
+ * @param dialogPage
+ * the dialog page
*/
- public DiagramLinkColorGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramLinkColorGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramNodeColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramNodeColorGroup.java
index 851c66166fd..b7a95dad6df 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramNodeColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/diagram/DiagramNodeColorGroup.java
@@ -26,16 +26,20 @@ public class DiagramNodeColorGroup extends NodeColorGroup {
/**
* Instantiates a new diagram node color group.
*
- * @param parent the parent composite
- * @param key the kind of the diagram
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the kind of the diagram
+ * @param dialogPage
+ * the dialog page
*/
- public DiagramNodeColorGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public DiagramNodeColorGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/AbstractPreferenceKeyDialog.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
index 6775ddde211..8d3cc6365da 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
@@ -41,45 +41,48 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
/** The key table. */
protected Table keyTable;
-
+
/** The table viewer. */
protected TableViewer tableViewer;
-
+
/** The keys. */
protected String[] keys;
/**
* Instantiates a new abstract preference key dialog.
*
- * @param keys the array of preference jy to display
+ * @param keys
+ * the array of preference jy to display
*/
public AbstractPreferenceKeyDialog(String[] keys) {
super(new Shell());
- this.keys=keys;
+ this.keys = keys;
setStatusLineAboveButtons(true);
- updateStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,"Would you like to overload those preferences?"));
+ updateStatus(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Would you like to overload those preferences?"));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite= (Composite)super.createDialogArea(parent);
- keyTable= new Table(composite, SWT.CHECK|SWT.BORDER);
- tableViewer=new TableViewer(keyTable);
+ Composite composite = (Composite)super.createDialogArea(parent);
+ keyTable = new Table(composite, SWT.CHECK | SWT.BORDER);
+ tableViewer = new TableViewer(keyTable);
tableViewer.setLabelProvider(new KeyLabelProvider());
tableViewer.setContentProvider(new KeyContentProvider());
- TableColumn column = new TableColumn(keyTable,SWT.NONE);
+ TableColumn column = new TableColumn(keyTable, SWT.NONE);
column.setWidth(150);
column.setText("Pref. kind ");
- column = new TableColumn(keyTable,SWT.NONE);
+ column = new TableColumn(keyTable, SWT.NONE);
column.setWidth(90);
column.setText("Level");
- column = new TableColumn(keyTable,SWT.NONE);
+ column = new TableColumn(keyTable, SWT.NONE);
column.setWidth(200);
column.setText("Localization");
tableViewer.setInput(keys);
@@ -96,64 +99,72 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
protected class KeyLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
*/
public Color getForeground(Object element, int columnIndex) {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
*/
public Color getBackground(Object element, int columnIndex) {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
public Image getColumnImage(Object element, int columnIndex) {
- if(columnIndex==0){
- if( element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
- return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/pref.gif");
+ if(columnIndex == 0) {
+ if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/pref.gif");
}
- if( element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
- return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/diag.gif");
+ if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/diag.gif");
}
}
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
*/
public String getColumnText(Object element, int columnIndex) {
- String initialKey= element.toString();
- String out=initialKey.toString();
- if(columnIndex==0){
- out=out.substring(out.indexOf(".")+1, out.length()).toUpperCase();
+ String initialKey = element.toString();
+ String out = initialKey.toString();
+ if(columnIndex == 0) {
+ out = out.substring(out.indexOf(".") + 1, out.length()).toUpperCase();
}
- if(columnIndex==1){
- if( element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
- return "ELEMENT";
+ if(columnIndex == 1) {
+ if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ return "ELEMENT";
}
- if( element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
- return "DIAGRAM";
+ if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ return "DIAGRAM";
+ }
+ }
+ if(columnIndex == 2) {
+ if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, "");
+ out = out.substring(out.lastIndexOf("_") + 1, out.indexOf(".")) + " (" + initialKey.substring(8, initialKey.lastIndexOf("_")) + ")";
+ }
+ if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX, "");
+ out = out.substring(0, out.indexOf("."));
}
}
- if(columnIndex==2){
- if( initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
- out=initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, "");
- out =out.substring( out.lastIndexOf("_")+1,out.indexOf("."))+" ("+initialKey.substring(8, initialKey.lastIndexOf("_"))+")";
- }
- if( initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
- out=initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX, "");
- out =out.substring( 0,out.indexOf("."));
- }
- }
return out;
}
}
@@ -162,30 +173,36 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
/**
* The Class KeyContentProvider.
*/
- protected class KeyContentProvider implements IStructuredContentProvider{
+ protected class KeyContentProvider implements IStructuredContentProvider {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
- ArrayList<String> result= new ArrayList<String>();
- for( int i=0; i< keys.length;i++){
- if( keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)){
+ ArrayList<String> result = new ArrayList<String>();
+ for(int i = 0; i < keys.length; i++) {
+ if(keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
result.add(keys[i]);
}
- if( keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)){
+ if(keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
result.add(keys[i]);
}
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java
index 0729a547798..54a2a350a58 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java
@@ -18,20 +18,20 @@ import java.util.ArrayList;
/**
* The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys
*/
-public class ApplyValueOnPreferenceKeyDialog extends
- AbstractPreferenceKeyDialog {
+public class ApplyValueOnPreferenceKeyDialog extends AbstractPreferenceKeyDialog {
/** The checked key. */
protected ArrayList<String> checkedKey;
-
+
/**
* Instantiates a new apply value on preference key dialog.
*
- * @param keys the keys
+ * @param keys
+ * the keys
*/
public ApplyValueOnPreferenceKeyDialog(String[] keys) {
super(keys);
- checkedKey= new ArrayList<String>();
+ checkedKey = new ArrayList<String>();
// TODO Auto-generated constructor stub
}
@@ -40,32 +40,36 @@ public class ApplyValueOnPreferenceKeyDialog extends
*
* @return the key to remove
*/
- public ArrayList<String> getKeyToRemove(){
+ public ArrayList<String> getKeyToRemove() {
return checkedKey;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
-
-
- for( int i =0;i<keyTable.getItems().length;i++){
- if(keyTable.getItems()[i].getChecked()){
+
+
+ for(int i = 0; i < keyTable.getItems().length; i++) {
+ if(keyTable.getItems()[i].getChecked()) {
checkedKey.add((String)keyTable.getItems()[i].getData());
}
}
super.okPressed();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
*/
@Override
protected void cancelPressed() {
super.cancelPressed();
- checkedKey= new ArrayList<String>();
+ checkedKey = new ArrayList<String>();
}
}
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorBackgroundColor.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorBackgroundColor.java
index e5209097a0f..7904688260a 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorBackgroundColor.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorBackgroundColor.java
@@ -19,23 +19,27 @@ import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
- * The Class EditorBackgroundColor is the back ground group specailized at the papyrus editor level.
+ * The Class EditorBackgroundColor is the back ground group specailized at the papyrus editor level.
*/
public class EditorBackgroundColor extends BackgroundColor {
/**
* Instantiates a new editor background color.
*
- * @param parent the parent composite
- * @param key the key of the preference
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key of the preference
+ * @param dialogPage
+ * the dialog page
*/
- public EditorBackgroundColor(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorBackgroundColor(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorConnectionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorConnectionGroup.java
index e5648552074..ca0ebc1d30a 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorConnectionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorConnectionGroup.java
@@ -26,16 +26,20 @@ public class EditorConnectionGroup extends ConnectionGroup {
/**
* Instantiates a new editor connection group.
*
- * @param parent the parent composite
- * @param key the title
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the title
+ * @param dialogPage
+ * the dialog page
*/
- public EditorConnectionGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorConnectionGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDecorationGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDecorationGroup.java
index 5a9e4cc151e..b8ea5aeafc0 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDecorationGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDecorationGroup.java
@@ -26,16 +26,20 @@ public class EditorDecorationGroup extends DecorationGroup {
/**
* Instantiates a new editor decoration group.
*
- * @param parent the parent composite
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
- public EditorDecorationGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorDecorationGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDimensionGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDimensionGroup.java
index ff6b276b4f6..955c233276f 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDimensionGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorDimensionGroup.java
@@ -26,16 +26,20 @@ public class EditorDimensionGroup extends DimensionGroup {
/**
* Instantiates a new editor dimension group.
*
- * @param parent the parent composite
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
- public EditorDimensionGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorDimensionGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorFontGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorFontGroup.java
index 6dc23f0e588..5ef7ff20f73 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorFontGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorFontGroup.java
@@ -26,15 +26,20 @@ public class EditorFontGroup extends FontGroup {
/**
* Instantiates a new editor font group.
*
- * @param parent the parent composite
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
public EditorFontGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorLinkColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorLinkColorGroup.java
index e6f36dc39e5..5988e5aea24 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorLinkColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorLinkColorGroup.java
@@ -26,16 +26,20 @@ public class EditorLinkColorGroup extends LinkColorGroup {
/**
* Instantiates a new editor link color group.
*
- * @param parent the parent composite
- * @param key the title
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the title
+ * @param dialogPage
+ * the dialog page
*/
- public EditorLinkColorGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorLinkColorGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorNodeColorGroup.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorNodeColorGroup.java
index 0ec9c80e181..3250b3cbda8 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorNodeColorGroup.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/ui/editor/EditorNodeColorGroup.java
@@ -26,16 +26,20 @@ public class EditorNodeColorGroup extends NodeColorGroup {
/**
* Instantiates a new editor node color group.
*
- * @param parent the parent composite
- * @param key the key
- * @param dialogPage the dialog page
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key
+ * @param dialogPage
+ * the dialog page
*/
- public EditorNodeColorGroup(Composite parent, String key,
- DialogPage dialogPage) {
+ public EditorNodeColorGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.papyrus.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
diff --git a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/utils/PreferenceConstantHelper.java b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/utils/PreferenceConstantHelper.java
index 9d46ea15939..5194a34f21e 100644
--- a/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/utils/PreferenceConstantHelper.java
+++ b/plugins/core/org.eclipse.papyrus.preferences/src/org/eclipse/papyrus/preferences/utils/PreferenceConstantHelper.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Thibault Landre (Atos Origin) - Initial API and implementation
- *
+ * Lorenzo Vincent (CEA LIST) - Add Compartment Visibility
*****************************************************************************/
package org.eclipse.papyrus.preferences.utils;
@@ -44,18 +44,18 @@ public class PreferenceConstantHelper {
/**
* Prefix for preference for Papyrus Level editor
*/
- public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX="PAPYRUS_EDITOR";
+ public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_EDITOR"; //$NON-NLS-1$
/**
- * Prefix for preference for Diagram Level
+ * Prefix for preference for Diagram Level
*/
- public static String DIAGRAM_PREFERENCE_PREFIX="DIAGRAM_";
+ public static String DIAGRAM_PREFERENCE_PREFIX = "DIAGRAM_"; //$NON-NLS-1$
/**
- * Prefix for preference for element Level
+ * Prefix for preference for element Level
*/
- public static String DIAGRAM_ELEMENT="ELEMENT_";
-
+ public static String DIAGRAM_ELEMENT = "ELEMENT_"; //$NON-NLS-1$
+
private final static String COLOR = "color."; //$NON-NLS-1$
private final static String GRADIENT = "gradient"; //$NON-NLS-1$
@@ -93,18 +93,22 @@ public class PreferenceConstantHelper {
private final static String ROUTING_STYLE_CONSTANT = ROUTING + ".style"; //$NON-NLS-1$
private final static String SMOOTHNESS_CONSTANT = "smoothness"; //$NON-NLS-1$
-
+
private final static String SHADOW_CONSTANT = "shadow"; //$NON-NLS-1$
-
+
private final static String ELEMENTICON_CONSTANT = "elementicon"; //$NON-NLS-1$
-
+
private final static String QUALIFIEDNAME_CONSTANT = "qualifiedname"; //$NON-NLS-1$
-
+
private final static String HEIGHT_CONSTANT = "height";//$NON-NLS-1$
private final static String WIDTH_CONSTANT = "width"; //$NON-NLS-1$
+ private final static String COMPARTMENT_VISIBILITY_CONSTANT = "compartment.visibility"; //$NON-NLS-1$
+
+ private final static String COMPARTMENT_NAME_VISIBILITY_CONSTANT = "compartment_name.visibility"; //$NON-NLS-1$
+
/**
* A preference of type COLOR FILL
*/
@@ -169,7 +173,7 @@ public class PreferenceConstantHelper {
* A preference of type SMOOTHNESS
*/
public final static int SMOOTHNESS = ROUTING_STYLE + 1;
-
+
/**
* A preference of type Shadow
*/
@@ -179,7 +183,7 @@ public class PreferenceConstantHelper {
* A preference of type elementIcon
*/
public final static int ELEMENTICON = SHADOW + 1;
-
+
/**
* A preference of type QualifiedName
*/
@@ -188,15 +192,24 @@ public class PreferenceConstantHelper {
/**
* A preference of type height
*/
- public static final int HEIGHT = QUALIFIEDNAME+1;
+ public static final int HEIGHT = QUALIFIEDNAME + 1;
/**
* A preference of type width
*/
- public static final int WIDTH = HEIGHT+1;
+ public static final int WIDTH = HEIGHT + 1;
+ /**
+ * A preference of type compartment visibility
+ */
+ public static final int COMPARTMENT_VISIBILITY = WIDTH + 1;
+ /**
+ * A preference of type compartment visibility
+ */
+ public static final int COMPARTMENT_NAME_VISIBILITY = COMPARTMENT_VISIBILITY + 1;
+
/**
* Get the preference constant used to store the preference of an element.
*
@@ -266,38 +279,66 @@ public class PreferenceConstantHelper {
case WIDTH:
sb.append(WIDTH_CONSTANT);
break;
+ case COMPARTMENT_VISIBILITY:
+ sb.append(COMPARTMENT_VISIBILITY_CONSTANT);
+ break;
+ case COMPARTMENT_NAME_VISIBILITY:
+ sb.append(COMPARTMENT_NAME_VISIBILITY_CONSTANT);
+ break;
default:
break;
}
return sb.toString();
}
-
+
/**
- *
- * @param elementName diagramKind+'_'+element
- * @param preferenceType the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ *
+ * @param elementName
+ * diagramKind+'_'+element
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
* @return the key for the element of a diagram
*/
public static String getElementConstant(String elementName, int preferenceType) {
- return DIAGRAM_ELEMENT+getConstant(elementName, preferenceType);
+ return DIAGRAM_ELEMENT + getConstant(elementName, preferenceType);
+ }
+
+ /**
+ *
+ * @param elementName
+ * diagramKind+'_'+element
+ * @param compartmentName
+ * the compartment name
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @return the key for the element of a diagram
+ */
+ public static String getCompartmentElementConstant(String elementName, String compartmentName, int preferenceType) {
+ String tmp = getElementConstant(elementName, preferenceType);
+ return tmp.replaceFirst("\\.", "_" + compartmentName + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+
/**
*
- * @param preferenceType the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
* @return get the preference key at the papyrus editor level
*/
- public static String getPapyrusEditorConstant( int preferenceType) {
+ public static String getPapyrusEditorConstant(int preferenceType) {
return getConstant(PAPYRUS_EDITOR_PREFERENCE_PREFIX, preferenceType);
}
+
/**
*
- * @param diagramKind the kind of diagram.
- * @param preferenceType the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @param diagramKind
+ * the kind of diagram.
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
* @return the preference key at the diagram level
*/
public static String getDiagramConstant(String diagramKind, int preferenceType) {
- return DIAGRAM_PREFERENCE_PREFIX+getConstant(diagramKind, preferenceType);
+ return DIAGRAM_PREFERENCE_PREFIX + getConstant(diagramKind, preferenceType);
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.properties.runtime/META-INF/MANIFEST.MF
index 453988151d1..de83123896b 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.properties.runtime;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.properties.runtime.Activator
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -35,4 +36,5 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.5.1",
org.eclipse.emf.edit.ui;bundle-version="2.6.0",
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.papyrus.core;bundle-version="0.7.0",
- org.eclipse.papyrus.uml.service.creation;bundle-version="0.7.0"
+ org.eclipse.papyrus.service.edit;bundle-version="0.7.1"
+
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/about.html b/plugins/core/org.eclipse.papyrus.properties.runtime/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/build.properties b/plugins/core/org.eclipse.papyrus.properties.runtime/build.properties
index b86e2a48ee0..5bb608e35c8 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/build.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/build.properties
@@ -6,6 +6,12 @@ bin.includes = META-INF/,\
bin/,\
icons/,\
schema/,\
- plugin.properties
+ plugin.properties,\
+ resources/,\
+ about.html
src.includes = icons/,\
- schema/
+ schema/,\
+ resources/,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.properties b/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.properties
index 966f635f084..eca8d530b54 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.properties
@@ -9,4 +9,4 @@
# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - initial API and implementation
##################################################################################
pluginName=Papyrus Properties Editor Runtime (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.xml b/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.xml
index 9bd2a5322d2..ef8f8c60782 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.xml
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/plugin.xml
@@ -18,7 +18,7 @@
description="This editor allows edition of String-valued properties"
factory="org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.PropertyEditorDescriptorFactory"
id="org.eclipse.papyrus.properties.runtime.textPropertyEditor"
- typeValidator="org.eclipse.papyrus.properties.runtime.propertyeditor.TextPropertyEditorValidator">
+ typeValidator="org.eclipse.papyrus.properties.runtime.propertyeditor.NullPropertyEditorTypeValidator">
</PropertyEditor>
<PropertyEditor
allowMultiValue="false"
@@ -68,6 +68,22 @@
id="org.eclipse.papyrus.properties.runtime.multipleStructuralFeaturesPropertyEditor"
typeValidator="org.eclipse.papyrus.properties.runtime.propertyeditor.MultipleStructuralFeaturesPropertyEditorValidator">
</PropertyEditor>
+ <PropertyEditor
+ allowMultiValue="true"
+ class="org.eclipse.papyrus.properties.runtime.propertyeditor.MultiplePrimitiveTypedPropertyEditor"
+ description="This is a basic editor for multiple primitive typed values"
+ factory="org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.MultiplePrimitiveTypedPropertyEditorDescriptorFactory"
+ id="org.eclipse.papyrus.properties.runtime.multiplePrimitiveTypedPropertyEditor"
+ typeValidator="org.eclipse.papyrus.properties.runtime.propertyeditor.MultiplePrimitiveTypedPropertyEditorValidator">
+ </PropertyEditor>
+ <PropertyEditor
+ allowMultiValue="true"
+ class="org.eclipse.papyrus.properties.runtime.propertyeditor.NullPropertyEditor"
+ description="Property Editor that displays no information, only an empty composite"
+ factory="org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.PropertyEditorDescriptorFactory"
+ id="org.eclipse.papyrus.properties.runtime.nullPropertyEditor"
+ typeValidator="org.eclipse.papyrus.properties.runtime.propertyeditor.NullPropertyEditorTypeValidator">
+ </PropertyEditor>
</propertyEditorProvider>
</extension>
<extension
@@ -103,6 +119,11 @@
factory="org.eclipse.papyrus.properties.runtime.controller.descriptor.EMFTPropertyEditorControllerDescriptorFactory"
id="emftLabelProviderStructuralFeatureController">
</PropertyEditorController>
+ <PropertyEditorController
+ class="org.eclipse.papyrus.properties.runtime.controller.NullPropertyEditorController"
+ factory="org.eclipse.papyrus.properties.runtime.controller.descriptor.NullPropertyEditorControllerDescriptorFactory"
+ id="nullPropertyEditorController">
+ </PropertyEditorController>
</propertyEditorControllerProvider>
</extension>
<extension
@@ -156,4 +177,20 @@
name="Reference Stereotype Model Handler">
</propertyModelHandler>
</extension>
+<extension
+ point="org.eclipse.papyrus.properties.runtime.propertyEditorControllerProvider">
+ <propertyEditorControllerProvider
+ class="org.eclipse.papyrus.properties.runtime.controller.predefined.PredefinedPropertyControllerProvider"
+ description="These are the basic predefined controllers for all runtime views"
+ id="org.eclipse.papyrus.properties.runtime.predefinedControllers">
+ <Priority
+ name="Lowest">
+ </Priority>
+ <PredefinedControllers
+ id="org.eclipse.papyrus.properties.runtime.predefinedControllers"
+ name="Standard Controllers"
+ path="resources/predefined_controllers.xml">
+ </PredefinedControllers>
+ </propertyEditorControllerProvider>
+</extension>
</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/resources/predefined_controllers.xml b/plugins/core/org.eclipse.papyrus.properties.runtime/resources/predefined_controllers.xml
new file mode 100644
index 00000000000..be82a9f812c
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/resources/predefined_controllers.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<predefinedControllers>
+ <predefinedController id="nullPropertyEditorController" predefinedId="emptyComposite"><editor id="org.eclipse.papyrus.properties.runtime.nullPropertyEditor"/></predefinedController>
+</predefinedControllers> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/Messages.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/Messages.java
index e43f544b846..2366c6d4d4b 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/Messages.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/Messages.java
@@ -27,6 +27,8 @@ public class Messages extends NLS {
/** Label for the Operation: Destroy operation */
public static String EMFTEReferenceController_DeleteElement_OperationLabel;
+ public static String ReferenceEMFModelHandler_Select_Values;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTEReferenceController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTEReferenceController.java
index 96999237245..47c1a2f411d 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTEReferenceController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTEReferenceController.java
@@ -31,10 +31,7 @@ import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
@@ -46,7 +43,8 @@ import org.eclipse.papyrus.core.utils.DisplayUtils;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.Messages;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.EMFFeatureModelHandler;
-import org.eclipse.papyrus.uml.service.creation.element.UMLTypeContext;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
import org.eclipse.swt.widgets.Shell;
/**
@@ -227,27 +225,26 @@ public class EMFTEReferenceController extends EMFTStructuralFeatureController im
if(!(feature instanceof EReference)) {
return undoableOperations;
}
- IClientContext context;
+ //IClientContext context;
try {
- context = UMLTypeContext.getContext();
+ //context = UMLTypeContext.getContext();
+
+
// Use UML service creation context and look for element types that are possible types of
// the selected EReference
- IElementType[] featureTypes = ElementTypeRegistry.getInstance().getContainedTypes(eObject, (EReference)feature, context);
- if(featureTypes != null) {
- for(int i = 0; i < featureTypes.length; i++) {
- IElementType nextFeatureType = featureTypes[i];
-
- CreateElementRequest request = new CreateElementRequest(getEditingDomain(), eObject, nextFeatureType, (EReference)feature);
- request.setLabel(Messages.bind(Messages.EMFTEReferenceController_CreationOperationMenuLabel, nextFeatureType.getDisplayName()));
- ICommand command = nextFeatureType.getEditCommand(request);
- if(command.canExecute()) {
- // adds it to the list of command that can be
- // executed
- undoableOperations.add(command);
- }
+ List<IElementEditService> containedTypeServices = ElementEditServiceUtils.getEditServiceProvider().getContainedTypeEditServices(eObject, (EReference)feature);
+ for(IElementEditService service : containedTypeServices) {
+ CreateElementRequest request = new CreateElementRequest(getEditingDomain(), eObject, (IElementType)service.getAdapter(IElementType.class), (EReference)feature);
+ request.setLabel(Messages.bind(Messages.EMFTEReferenceController_CreationOperationMenuLabel, service.getDisplayName()));
+ ICommand command = service.getEditCommand(request);
+ if(command.canExecute()) {
+ // adds it to the list of command that can be
+ // executed
+ undoableOperations.add(command);
}
}
+
} catch (Exception e) {
Activator.log.error(e);
}
@@ -288,173 +285,18 @@ public class EMFTEReferenceController extends EMFTStructuralFeatureController im
return undoableOperation;
}
EObject eObject = getObjectsToEdit().get(0);
- IClientContext context;
- try {
- context = UMLTypeContext.getContext();
- IElementType type = ElementTypeRegistry.getInstance().getElementType(eObject, context);
- IEditHelper helper = type.getEditHelper();
- for(Object objectToDelete : objectsToDelete) {
- if(objectToDelete instanceof EObject) {
- DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), (EObject)objectToDelete, false);
- IUndoableOperation operation = helper.getEditCommand(request);
- if(operation != null && operation.canExecute()) {
- undoableOperation.add(operation);
- }
- } else {
- Activator.log.debug("the object to delete was not an EObject: " + objectToDelete);
- }
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
- return undoableOperation.reduce();
- }
-
- /**
- * {@inheritDoc}
- */
- public IUndoableOperation getMoveCurrentValuesOperation(List<Object> objects, int move) {
- IUndoableOperation undoableOperation = null;
- EClass eClass = retrieveEClass();
- if(eClass == null || getObjectsToEdit() == null || getObjectsToEdit().size() == 0 || !(getModelHandler() instanceof EMFFeatureModelHandler)) {
- return undoableOperation;
- }
- EObject eObject = getObjectsToEdit().get(0);
- // retrieve the current value (should be a list)
- EStructuralFeature feature = ((EMFFeatureModelHandler)getModelHandler()).getFeatureByName(eObject);
- Object currentValue = eObject.eGet(feature);
- if(currentValue instanceof List<?>) {
- @SuppressWarnings("unchecked")
- List<EObject> values = (List<EObject>)currentValue;
- List<EObject> copy = new ArrayList<EObject>(values);
- // make modification in copy list
- // check indices
- int min = copy.size();
- int max = 0;
-
- for(Object object : objects) {
- int index = copy.indexOf(object);
- if(index == -1) {
- Activator.log.debug("Impossible to find the index for object :" + object);
- }
- if(index < min) {
- min = index;
- }
- if(index > max) {
- max = index;
- }
- }
-
- // check that min and max are in the bounds of the list, with the
- // delta applied
- min += move;
- max += move;
- // check the bounds of the list
- if(min < 0) {
- Activator.log.debug("Trying to move up the elements, with a move which will cause an IndexOutOfBound exception");
- return undoableOperation;
- } else if(max >= copy.size()) {
- Activator.log.debug("Trying to move down the elements, with a move which will cause an IndexOutOfBound exception");
- return undoableOperation;
- }
-
- // now, do the move in the copy
- if(move < 0) {
- moveUpElementsInCollection(copy, objects, move);
- } else {
- moveDownElementsOperation(copy, objects, move);
- }
-
- // now, apply the new value
- IClientContext context;
- try {
- context = UMLTypeContext.getContext();
- IElementType type = ElementTypeRegistry.getInstance().getElementType(eObject, context);
- IEditHelper helper = type.getEditHelper();
-
- SetRequest request = new SetRequest(getEditingDomain(), eObject, feature, copy);
- IUndoableOperation operation = helper.getEditCommand(request);
+ for(Object objectToDelete : objectsToDelete) {
+ if(objectToDelete instanceof EObject) {
+ DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), (EObject)objectToDelete, false);
+ IUndoableOperation operation = ElementEditServiceUtils.getCommandProvider(objectToDelete).getEditCommand(request);
if(operation != null && operation.canExecute()) {
- undoableOperation = operation;
+ undoableOperation.add(operation);
}
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
- return undoableOperation;
- }
-
- /**
- * Moves the element in the specified list, when the elements are moved down
- * in the list
- *
- * @param modifiedElements
- * list of elements modified
- * @param objectsToMove
- * list of objects to move
- * @param move
- * delta for the move. should be positive integer
- */
- protected void moveDownElementsOperation(List<EObject> modifiedElements, List<Object> objectsToMove, int move) {
- // if moving down, starting from the end to move elements, assuming they
- // are in the increasing order by default
- Collections.reverse(objectsToMove);
- for(Object objectToMove : objectsToMove) {
- // retrieve index
- int index = modifiedElements.indexOf(objectToMove);
- // remove element
- modifiedElements.remove(index);
- // change index
- if(index == -1) {
- return;
- }
- index += move;
- // add the element to the new index
- modifiedElements.add(index, (EObject)objectToMove);
- }
- }
-
- /**
- * Moves the element in the specified list, when the elements are moved up
- * in the list
- *
- * @param modifiedElements
- * list of elements modified
- * @param objectsToMove
- * list of objects to move
- * @param move
- * delta for the move. should be positive integer
- */
- protected void moveUpElementsInCollection(List<EObject> modifiedElements, List<Object> objectsToMove, int move) {
- for(Object objectToMove : objectsToMove) {
- // retrieve index
- int index = modifiedElements.indexOf(objectToMove);
- // remove element
- modifiedElements.remove(index);
- // change index
- if(index == -1) {
- return;
+ } else {
+ Activator.log.debug("the object to delete was not an EObject: " + objectToDelete);
}
- index += move;
- // add the element to the new index
- modifiedElements.add(index, (EObject)objectToMove);
}
- }
- /**
- * {@inheritDoc}
- */
- public boolean canMoveValues() {
- EClass eClass = retrieveEClass();
- if(eClass == null || getObjectsToEdit() == null || getObjectsToEdit().size() == 0 || !(getModelHandler() instanceof EMFFeatureModelHandler)) {
- return false;
- }
- EObject eObject = getObjectsToEdit().get(0);
- EStructuralFeature feature = ((EMFFeatureModelHandler)getModelHandler()).getFeatureByName(eObject);
- if(feature == null) {
- return false;
- }
- return feature.isOrdered();
+ return undoableOperation.reduce();
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
index b802eaa091e..af859ac57e3 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTPropertyEditorController.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.controller;
@@ -18,9 +19,15 @@ import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler;
+import org.eclipse.papyrus.properties.runtime.modelhandler.emf.TransactionUtil;
/**
@@ -29,9 +36,12 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
*/
public abstract class EMFTPropertyEditorController extends EMFPropertyEditorController {
- /** Transactional editing domain used to wirte into the model */
+ /** Transactional editing domain used to write into the model */
private TransactionalEditingDomain editingDomain;
+ /** model handler to interact with the model for this controller */
+ protected IEMFModelHandler modelHandler;
+
/**
* Constructor.
*/
@@ -40,12 +50,51 @@ public abstract class EMFTPropertyEditorController extends EMFPropertyEditorCont
}
/**
- * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.properties.runtime.controller.PropertyEditorController#updateModel()
+ *
*/
@Override
public void updateModel() {
+ CompositeCommand cc = new CompositeCommand("Set Value Command"); //$NON-NLS-1$
+ Object valueToSet = getEditorValue();
+ for(Object obj : this.objectToEdit) {
+ EObject elementToEdit = (EObject)obj;
+ //build the request
+ SetRequest[] req = null;
+ req = modelHandler.getSetRequest(getEditingDomain(), elementToEdit, valueToSet);
+ if(req == null) {
+ break;
+ }
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(elementToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : req) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ cc.add(editCommand);
+ }
+ }
+ }
+
+ if(cc.canExecute() && !(TransactionUtil.isReadTransactionInProgress(getEditingDomain(), true, true))) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(cc, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ log.error(e);
+ }
+ return;
+ }
+ }
+
+ /*
+ * req was null, or the command was unexecutable
+ * Currently, the handler for stereotype return always null!
+ */
AbstractTransactionalCommand command = new EMFTControllerCommand();
- if(command.canExecute()) {
+ if(command.canExecute() && !(TransactionUtil.isReadTransactionInProgress(editingDomain, true, true))) {
try {
OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -82,7 +131,7 @@ public abstract class EMFTPropertyEditorController extends EMFPropertyEditorCont
* Creates the new EMFTControllerCommand.
*/
public EMFTControllerCommand() {
- super(editingDomain, "Editing Property", getWorkspaceFiles(getObjectsToEdit()));
+ super(editingDomain, "Editing Property", getWorkspaceFiles(getObjectsToEdit())); //$NON-NLS-1$
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTStructuralFeatureController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTStructuralFeatureController.java
index 7c970af4d1b..e7fd1dc0e83 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTStructuralFeatureController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/EMFTStructuralFeatureController.java
@@ -8,25 +8,26 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.controller;
-import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.controller.descriptor.EMFTPropertyEditorControllerDescriptor;
import org.eclipse.papyrus.properties.runtime.controller.descriptor.IPropertyEditorControllerDescriptor;
import org.eclipse.papyrus.properties.runtime.controller.predefined.PredefinedControllerDescriptor;
+import org.eclipse.papyrus.properties.runtime.modelhandler.emf.EMFUtils;
import org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.swt.widgets.Composite;
@@ -41,10 +42,7 @@ public class EMFTStructuralFeatureController extends EMFTPropertyEditorControlle
private EMFTPropertyEditorControllerDescriptor descriptor;
/** identifier of the controller */
- public final static String ID = "emftStructuralFeatureController";
-
- /** model handler to interact with the model for this controller */
- protected IEMFModelHandler modelHandler;
+ public final static String ID = "emftStructuralFeatureController"; //$NON-NLS-1$
/**
* Creates a new EMFTStructuralFeatureController.
@@ -63,6 +61,7 @@ public class EMFTStructuralFeatureController extends EMFTPropertyEditorControlle
* @param descriptor
* the descriptor that realize specific configuration for this controller
*/
+ @Override
public IStatus initController(Composite parent, List<Object> objectsToEdit, IPropertyEditorControllerDescriptor descriptor) {
setParent(parent);
IPropertyEditorControllerDescriptor realDescriptor = descriptor;
@@ -75,27 +74,15 @@ public class EMFTStructuralFeatureController extends EMFTPropertyEditorControlle
if(realDescriptor instanceof EMFTPropertyEditorControllerDescriptor) {
this.descriptor = (EMFTPropertyEditorControllerDescriptor)realDescriptor;
} else {
- return new Status(IStatus.ERROR, Activator.ID, "impossible to adapt descriptor to an EMFTPropertyEditorControllerDescriptor");
+ return new Status(IStatus.ERROR, Activator.ID, "impossible to adapt descriptor to an EMFTPropertyEditorControllerDescriptor"); //$NON-NLS-1$
}
this.modelHandler = this.descriptor.getHandler();
setObjectsToEdit(objectsToEdit);
-
-
- TransactionalEditingDomain editingDomain = null;
- Iterator<Object> it2 = objectsToEdit.iterator();
- while(it2.hasNext() && editingDomain == null) {
- editingDomain = TransactionUtil.getEditingDomain(it2.next());
- }
-
- // if impossible to find editing domain this way: Tries the Papyrus service
- if(editingDomain == null) {
- editingDomain = EditorUtils.getTransactionalEditingDomain();
- }
-
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
if(editingDomain == null && !objectsToEdit.isEmpty()) {
- return new Status(IStatus.ERROR, Activator.ID, "impossible to find an editing domain for the controller.");
+ return new Status(IStatus.ERROR, Activator.ID, "impossible to find an editing domain for the controller."); //$NON-NLS-1$
}
setEditingDomain(editingDomain);
return Status.OK_STATUS;
@@ -224,4 +211,77 @@ public class EMFTStructuralFeatureController extends EMFTPropertyEditorControlle
// nothing to do here, as the adapter already knows the target
}
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getMoveCurrentValuesOperation(List<Integer> indexes, int delta) {
+ return getModelHandler().getMoveValueOperation(getObjectsToEdit(), indexes, getComposite(), delta);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canMoveValues(List<Integer> indexes, int delta) {
+ return getModelHandler().canCreateMoveValueOperation(getObjectsToEdit(), indexes, getComposite(), delta);
+ }
+
+ /**
+ * Retrieves the common metaclass for all selected objects
+ *
+ * @return the selected metaclass
+ *
+ */
+ protected EClass retrieveEClass() {
+ @SuppressWarnings("unchecked")
+ List<EObject> eObjects = (List<EObject>)getObjectsToEdit();
+ if(eObjects == null) {
+ return null;
+ } else if(eObjects.size() > 0) {
+ return eObjects.get(0).eClass();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<IUndoableOperation> getCreateValueOperations() {
+ return getModelHandler().getCreateValueOperations(getObjectsToEdit(), getComposite());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateValueOperations() {
+ return getModelHandler().canCreateValueOperations(getObjectsToEdit());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getDeleteValueOperation(List<Integer> indexes) {
+ return getModelHandler().getDeleteValueOperation(getObjectsToEdit(), getComposite(), indexes);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canDeleteValueOperation() {
+ return getModelHandler().canCreateDeleteValueOperation(getObjectsToEdit());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getEditValueOperation(int index, Composite parent, Object value) {
+ return getModelHandler().getEditValueOperation(getObjectsToEdit(), index, parent, value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateEditOperation(int index, Composite parent, Object value) {
+ return true;
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IBoundedValuesController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IBoundedValuesController.java
index cc52a3a39bf..03e2376522a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IBoundedValuesController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IBoundedValuesController.java
@@ -13,7 +13,6 @@ package org.eclipse.papyrus.properties.runtime.controller;
import java.util.List;
-import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -33,24 +32,6 @@ public interface IBoundedValuesController extends ILabelProviderController {
public Object getAvailableValues();
/**
- * Moves the given list of Objects in the list
- *
- * @param objects
- * the list of objects to move
- * @param move
- * the delta for the index (0: stays at the same place, -1: everything move upper, +2: everything moves 2 index further)
- * @return the operation that moves the elements or <code>null</code>
- */
- public IUndoableOperation getMoveCurrentValuesOperation(List<Object> objects, int move);
-
- /**
- * Indicates if the values can be moved in the feature
- *
- * @return <code>true</code> if the values can be moved, else <code>false</code>
- */
- public boolean canMoveValues();
-
- /**
* Returns the list of current values
*
* @return the list of current values
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IPropertyEditorController.java
index 11a55052f53..10c91bce6e8 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IPropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/IPropertyEditorController.java
@@ -13,10 +13,12 @@ package org.eclipse.papyrus.properties.runtime.controller;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.papyrus.properties.runtime.controller.descriptor.IPropertyEditorControllerDescriptor;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
@@ -60,8 +62,10 @@ public interface IPropertyEditorController {
*
* @param descriptor
* the image descriptor for the property editor
+ * @param widgetFactory
+ * widget factory used to create the content of the editor
*/
- public void createPropertyEditor(IPropertyEditorDescriptor descriptor);
+ public void createPropertyEditor(IPropertyEditorDescriptor descriptor, TabbedPropertySheetWidgetFactory widgetFactory);
/**
* Initialize the controller.
@@ -81,4 +85,84 @@ public interface IPropertyEditorController {
*/
public void refreshDisplay();
+ /**
+ * Moves the given list of Objects in the list
+ *
+ * @param indexes
+ * the indexes of objects to move
+ * @param move
+ * the delta for the index (0: stays at the same place, -1: everything move upper, +2: everything moves 2 index further)
+ * @return the operation that moves the elements or <code>null</code>
+ */
+ public IUndoableOperation getMoveCurrentValuesOperation(List<Integer> indexes, int move);
+
+ /**
+ * Indicates if the values can be moved in the feature
+ *
+ * @param indexes
+ * the indexes of objects to move
+ * @param move
+ * the delta for the index (0: stays at the same place, -1: everything move upper, +2: everything moves 2 index further)
+ * @return <code>true</code> if the values can be moved, else <code>false</code>
+ */
+ public boolean canMoveValues(List<Integer> indexes, int move);
+
+ /**
+ * Returns the operation to create a new value for this property
+ *
+ * @return the operation to create a new value for this property
+ */
+ public List<IUndoableOperation> getCreateValueOperations();
+
+ /**
+ * Returns <code>true</code> if the controller can create a new value for the property
+ *
+ * @return <code>true</code> if the controller can create a new value for the property
+ */
+ public boolean canCreateValueOperations();
+
+ /**
+ * Returns the operation to delete a value for this property
+ *
+ * @param indexes
+ * list of indexes for values to delete (not used in case of single valued proeprty)
+ * @return the operation to delete a value for this property
+ */
+ public IUndoableOperation getDeleteValueOperation(List<Integer> indexes);
+
+ /**
+ * Returns <code>true</code> if the controller can delete a value for the property
+ *
+ * @return <code>true</code> if the controller can delete a value for the property
+ */
+ public boolean canDeleteValueOperation();
+
+ /**
+ * Returns the operation to edit a value for this property
+ *
+ * @param index
+ * the index of the value to set
+ * @param parent
+ * the composite parent used for user interface
+ * @param value
+ * the value to set
+ *
+ * @return the operation to edit a value for this property
+ */
+ public IUndoableOperation getEditValueOperation(int index, Composite parent, Object value);
+
+ /**
+ * Returns <code>true</code> if the controller can edit a value for the property
+ *
+ * @param index
+ * the index of the value to set
+ * @param parent
+ * the composite parent used for user interface
+ * @param value
+ * the value to set
+ *
+ * @return <code>true</code> if the controller can edit a value for the property
+ */
+ public boolean canCreateEditOperation(int index, Composite parent, Object value);
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/NullPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/NullPropertyEditorController.java
new file mode 100644
index 00000000000..89a24d8111a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/NullPropertyEditorController.java
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.controller;
+
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.properties.runtime.controller.descriptor.IPropertyEditorControllerDescriptor;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Controller for Empty property editors, i.e. editors that are a simple Composite
+ */
+public class NullPropertyEditorController extends PropertyEditorController {
+
+ /** id of this controller */
+ public static final String ID = "nullPropertyEditorController";
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getMoveCurrentValuesOperation(List<Integer> indexes, int move) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canMoveValues(List<Integer> indexes, int move) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<IUndoableOperation> getCreateValueOperations() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateValueOperations() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getDeleteValueOperation(List<Integer> indexes) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canDeleteValueOperation() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getEditValueOperation(int index, Composite parent, Object value) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateEditOperation(int index, Composite parent, Object value) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDefaultLabel() {
+ return "";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IStatus initPropertyEditor(IPropertyEditorDescriptor descriptor) {
+ return getPropertyEditor().init(descriptor);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IStatus initController(Composite parent, List<Object> objectsToEdit, IPropertyEditorControllerDescriptor descriptor) {
+ setParent(parent);
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setValueInModel(Object value) {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getValueToEdit() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void addListenersToModel() {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void removeListenersFromModel() {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void updateModel() {
+ // Nothing to do
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/PropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/PropertyEditorController.java
index 843ea9d7d7a..372bad0d326 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/PropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/PropertyEditorController.java
@@ -21,6 +21,7 @@ import org.eclipse.papyrus.properties.runtime.propertyeditor.PropertyEditorServi
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.services.IDisposable;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
@@ -116,9 +117,11 @@ public abstract class PropertyEditorController implements IDisposable, IProperty
/**
* {@inheritDoc}
+ *
+ * @param widgetFactory
*/
- public void createPropertyEditor(IPropertyEditorDescriptor descriptor) {
- setPropertyEditor(PropertyEditorService.getInstance().createPropertyEditor(this, descriptor.getEditorId()));
+ public void createPropertyEditor(IPropertyEditorDescriptor descriptor, TabbedPropertySheetWidgetFactory widgetFactory) {
+ setPropertyEditor(PropertyEditorService.getInstance().createPropertyEditor(this, descriptor.getEditorId(), widgetFactory));
IStatus status = initPropertyEditor(descriptor);
if(IStatus.ERROR != status.getSeverity()) {
getPropertyEditor().createContent(getComposite());
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/EMFTPropertyEditorControllerDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/EMFTPropertyEditorControllerDescriptor.java
index 136631017fd..858fe8b4e2b 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/EMFTPropertyEditorControllerDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/EMFTPropertyEditorControllerDescriptor.java
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.properties.runtime.state.IState;
import org.eclipse.papyrus.properties.runtime.state.ITraversableModelElement;
import org.eclipse.papyrus.properties.runtime.view.constraints.IConstraintDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -329,7 +330,7 @@ public class EMFTPropertyEditorControllerDescriptor implements IPropertyEditorCo
if(controller != null) {
// use the state to create this
- controller.createPropertyEditor(this.getDescriptor().getEditorDescriptor());
+ controller.createPropertyEditor(this.getDescriptor().getEditorDescriptor(), new TabbedPropertySheetWidgetFactory());
}
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptor.java
new file mode 100644
index 00000000000..9d50b6b9f78
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptor.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.controller.descriptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.properties.runtime.controller.NullPropertyEditorController;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.papyrus.properties.runtime.view.constraints.IConstraintDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Descriptor for {@link NullPropertyEditorController}
+ */
+public class NullPropertyEditorControllerDescriptor implements IPropertyEditorControllerDescriptor {
+
+ /** editor descriptor */
+ protected final IPropertyEditorDescriptor editorDescriptor;
+
+
+ /**
+ * Creates a new NullPropertyEditorControllerDescriptor.
+ *
+ * @param editorDescriptor
+ * the descriptor of the editor controller
+ */
+ public NullPropertyEditorControllerDescriptor(IPropertyEditorDescriptor editorDescriptor) {
+ this.editorDescriptor = editorDescriptor;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText() {
+ return "NullController";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Image getImage() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean acceptMultiSelection() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getControllerID() {
+ return NullPropertyEditorController.ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IPropertyEditorDescriptor getEditorDescriptor() {
+ return editorDescriptor;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<IConstraintDescriptor> getConstraintDescriptors() {
+ return new ArrayList<IConstraintDescriptor>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ControllerDescriptorState createState(boolean readOnly) {
+ return new ControllerDescriptorState(this, readOnly);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptorFactory.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptorFactory.java
new file mode 100644
index 00000000000..8ce934a2474
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/descriptor/NullPropertyEditorControllerDescriptorFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.controller.descriptor;
+
+import org.eclipse.papyrus.properties.runtime.controller.NullPropertyEditorController;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.PropertyEditorService;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * Factory for {@link NullPropertyEditorController}.
+ */
+public class NullPropertyEditorControllerDescriptorFactory implements IPropertyEditorControllerDescriptorFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public IPropertyEditorControllerDescriptor createDescriptor(Node controllerNode, Bundle bundle) {
+ // parse content of the node
+
+ IPropertyEditorDescriptor editorDescriptor = null;
+ NodeList children = controllerNode.getChildNodes();
+ for(int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if("editor".equals(child.getNodeName())) {
+ // retrieve editor id
+ if(child.hasAttributes()) {
+ Node editorIDNode = child.getAttributes().getNamedItem("id");
+ editorDescriptor = PropertyEditorService.getInstance().createPropertyEditorDescriptor(editorIDNode.getNodeValue(), child);
+ }
+
+ }
+ }
+
+ assert (editorDescriptor != null) : "impossible to create editor descriptor";
+
+ return new NullPropertyEditorControllerDescriptor(editorDescriptor);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/predefined/PredefinedControllerState.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/predefined/PredefinedControllerState.java
index 1dd942d3624..24e131fa662 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/predefined/PredefinedControllerState.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/controller/predefined/PredefinedControllerState.java
@@ -19,6 +19,7 @@ import org.eclipse.papyrus.properties.runtime.controller.PropertyEditorControlle
import org.eclipse.papyrus.properties.runtime.controller.PropertyEditorControllerService;
import org.eclipse.papyrus.properties.runtime.controller.descriptor.ControllerDescriptorState;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -124,7 +125,7 @@ public class PredefinedControllerState extends ControllerDescriptorState {
if(controller != null) {
// use the state to create this
- controller.createPropertyEditor(this.getDescriptor().getEditorDescriptor());
+ controller.createPropertyEditor(this.getDescriptor().getEditorDescriptor(), new TabbedPropertySheetWidgetFactory());
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/messages.properties b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/messages.properties
index 3a890d0f76e..9a93214aa9f 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/messages.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/messages.properties
@@ -1,2 +1,3 @@
EMFTEReferenceController_CreationOperationMenuLabel=Create a new {0}
EMFTEReferenceController_DeleteElement_OperationLabel=Delete elements
+ReferenceEMFModelHandler_Select_Values=Select Values
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/BooleanEMFModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/BooleanEMFModelHandler.java
index 745a4c5c7c1..bc73a83321a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/BooleanEMFModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/BooleanEMFModelHandler.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
@@ -16,6 +17,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IBoundedValuesPropertyEditorDescriptor;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
@@ -26,7 +29,7 @@ import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropert
public class BooleanEMFModelHandler extends EnumerationEMFModelHandler {
/** id of this model handler */
- public static final String ID = "Boolean";
+ public static final String ID = "Boolean"; //$NON-NLS-1$
/**
* Creates a new BooleanEMFModelHandler.
@@ -56,6 +59,7 @@ public class BooleanEMFModelHandler extends EnumerationEMFModelHandler {
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
@Override
public void setValueInModel(EObject objectToEdit, Object newValue) {
EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
@@ -63,12 +67,22 @@ public class BooleanEMFModelHandler extends EnumerationEMFModelHandler {
return;
}
// remove value if result of the editor is empty
- if(newValue == null || newValue.equals("")) {
+ if(newValue == null || newValue.equals("")) { //$NON-NLS-1$
objectToEdit.eUnset(featureToEdit);
} else if(newValue instanceof String) {
objectToEdit.eSet(featureToEdit, Boolean.parseBoolean((String)newValue));
} else if(newValue instanceof Boolean) {
- objectToEdit.eSet(featureToEdit, (Boolean)newValue);
+ objectToEdit.eSet(featureToEdit, newValue);
+ } else if(newValue instanceof List<?>) {
+ List<Object> newValues = new ArrayList<Object>();
+ for(Object value : (List<Object>)newValue) {
+ if(value instanceof String) {
+ newValues.add(Boolean.parseBoolean((String)value));
+ } else if(value instanceof Boolean) {
+ newValues.add(value);
+ }
+ }
+ objectToEdit.eSet(featureToEdit, newValues);
}
}
@@ -89,23 +103,56 @@ public class BooleanEMFModelHandler extends EnumerationEMFModelHandler {
// check if there is an empty string at the beginning. there is one if the lower bound of the feature to edit equal 0
if(featureToEdit.getLowerBound() == 0) {
- values.add("");
+ values.add(""); //$NON-NLS-1$
}
- values.add("true");
- values.add("false");
+ values.add("true"); //$NON-NLS-1$
+ values.add("false"); //$NON-NLS-1$
if(descriptor instanceof IBoundedValuesPropertyEditorDescriptor) {
((IBoundedValuesPropertyEditorDescriptor)descriptor).setAvailableValues(values);
} else {
- Activator.log.error("Warning: " + descriptor + "could not be completed.", null);
+ Activator.log.debug("Warning: " + descriptor + "could not be completed."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
* {@inheritDoc}
*/
+ @Override
public String getId() {
return ID;
}
+ /**
+ *
+ * @param objectToEdit
+ * @param newValue
+ * @return
+ */
+ @Override
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // remove value if result of the editor is empty
+ if(newValue == null || newValue.equals("")) { //$NON-NLS-1$
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, featureToEdit.getDefaultValue()) };
+ } else if(newValue instanceof String) {
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, Boolean.parseBoolean((String)newValue)) };
+ } else if(newValue instanceof Boolean) {
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, newValue) };
+ } else if(newValue instanceof List<?>) {
+ List<Object> newValues = new ArrayList<Object>();
+ for(Object value : (List<?>)newValue) {
+ if(value instanceof String) {
+ newValues.add(Boolean.parseBoolean((String)value));
+ } else if(value instanceof Boolean) {
+ newValues.add(value);
+ }
+ }
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, newValues) };
+ }
+ return null;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFFeatureModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFFeatureModelHandler.java
index 1fccb65f77d..853da8ae2d2 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFFeatureModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFFeatureModelHandler.java
@@ -8,24 +8,34 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.controller.EMFPropertyEditorController;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
/**
@@ -39,6 +49,12 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
/** factory used by EMF objects */
protected AdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ /** value of unset new value index */
+ public static final int NEW_VALUE_NOT_SET_INDEX = -2;
+
+ /** value of single value property */
+ public static final int SINGLE_VALUE_PROPERTY_INDEX = -1;
+
/**
* Creates a new EMFFeatureModelHandler.
*
@@ -110,14 +126,14 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
* {@inheritDoc}
*/
public String getText() {
- return "EMF Handler \"" + getId() + "\" -> " + getFeatureName();
+ return "EMF Handler \"" + getId() + "\" -> " + getFeatureName(); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public Image getImage() {
- return Activator.getImage("/icons/ModelHandler.gif");
+ return Activator.getImage("/icons/ModelHandler.gif"); //$NON-NLS-1$
}
/**
@@ -133,23 +149,23 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
public Object getAvailableValues(EObject eObject) {
EClass eClass = eObject.eClass();
if(eClass == null) {
- Activator.log.debug("problems during initialization, looking for availables values");
+ Activator.log.debug("problems during initialization, looking for availables values"); //$NON-NLS-1$
return null;
}
EStructuralFeature feature = getFeatureByName(eObject);
if(!(feature instanceof EReference)) {
- Activator.log.debug("feature is not a reference, looking for availables values: " + feature);
+ Activator.log.debug("feature is not a reference, looking for availables values: " + feature); //$NON-NLS-1$
return null;
}
IItemPropertySource itemPropertySource = (IItemPropertySource)factory.adapt(eObject, IItemPropertySource.class);
if(itemPropertySource == null) {
- Activator.log.debug("impossible to find item Property source for " + eObject);
+ Activator.log.debug("impossible to find item Property source for " + eObject); //$NON-NLS-1$
return null;
}
IItemPropertyDescriptor itemPropertyDescriptor = itemPropertySource.getPropertyDescriptor(eObject, feature);
if(itemPropertyDescriptor == null) {
- Activator.log.debug("impossible to find item Property descriptor for " + eObject + " and " + feature);
+ Activator.log.debug("impossible to find item Property descriptor for " + eObject + " and " + feature); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
return itemPropertyDescriptor.getChoiceOfValues(eObject);
@@ -170,7 +186,10 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
for(EObject eObject : objects) {
EStructuralFeature feature = getFeatureByName(eObject);
if(notificationFeature.equals(feature)) {
- ((EObject)notification.getNewValue()).eAdapters().add(adapter);
+ Object newValue = notification.getNewValue();
+ if(newValue instanceof EObject) {
+ ((EObject)newValue).eAdapters().add(adapter);
+ }
// refresh the editors
adapter.refreshDisplay();
}
@@ -181,8 +200,10 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
for(EObject eObject : objects) {
EStructuralFeature feature = getFeatureByName(eObject);
if(notificationFeature.equals(feature)) {
- for(EObject newValue : ((List<EObject>)notification.getNewValue())) {
- newValue.eAdapters().add(adapter);
+ for(Object newValue : ((List<Object>)notification.getNewValue())) {
+ if(newValue instanceof EObject) {
+ ((EObject)newValue).eAdapters().add(adapter);
+ }
}
// refresh the editors
adapter.refreshDisplay();
@@ -195,7 +216,11 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
for(EObject eObject : objects) {
EStructuralFeature feature = getFeatureByName(eObject);
if(notificationFeature.equals(feature)) {
- ((EObject)notification.getOldValue()).eAdapters().remove(this);
+ Object oldValue = notification.getOldValue();
+ if(oldValue instanceof EObject) {
+ ((EObject)oldValue).eAdapters().remove(this);
+ }
+
// refresh the editors
adapter.refreshDisplay();
}
@@ -206,8 +231,10 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
for(EObject eObject : objects) {
EStructuralFeature feature = getFeatureByName(eObject);
if(notificationFeature.equals(feature)) {
- for(EObject newValue : ((List<EObject>)notification.getOldValue())) {
- newValue.eAdapters().remove(adapter);
+ for(Object oldValue : ((List<Object>)notification.getOldValue())) {
+ if(oldValue instanceof EObject) {
+ ((EObject)oldValue).eAdapters().add(adapter);
+ }
}
// refresh the editors
adapter.refreshDisplay();
@@ -238,4 +265,740 @@ public abstract class EMFFeatureModelHandler implements IEMFModelHandler {
object.eAdapters().remove(controller);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent);
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateValueOperations(List<? extends EObject> objectsToEdit) {
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return false;
+ }
+
+ if(!featureToEdit.isChangeable()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getDeleteValueOperation(List<? extends EObject> objectsToEdit, Composite parent, List<Integer> indexes) {
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return null;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Edit Value"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // DeleteStringValueOperation operation = new DeleteStringValueOperation(editingDomain, "Edit Value", objectToEdit, indexes, parent);
+ IUndoableOperation operation = getDeleteStringValueOperation(editingDomain, "Edit Value", objectToEdit, indexes, parent); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ }
+ return command.reduce();
+ }
+
+ /**
+ * Returns the command to remove String values
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param string
+ * the name of the command
+ * @param objectToEdit
+ * the object to edit
+ * @param indexes
+ * the index of the element to remove
+ * @param parent
+ * the composite parent
+ * @return
+ * the command to remove String values
+ */
+ protected IUndoableOperation getDeleteStringValueOperation(TransactionalEditingDomain editingDomain, String string, EObject objectToEdit, List<Integer> indexes, Composite parent) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, string);
+ // get the feature to modify
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = featureToEdit.getDefaultValue();
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ for(int index : indexes) {
+ values.remove(index);
+ }
+ newValue = values;
+ }
+ SetRequest[] requests = getSetRequest(editingDomain, objectToEdit, newValue);
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(objectToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ return command;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateDeleteValueOperation(List<? extends EObject> objectsToEdit) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getEditValueOperation(List<? extends EObject> objectsToEdit, int index, Composite parent, Object value) {
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return null;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Edit Value"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // EditStringValueOperation operation = new EditStringValueOperation(editingDomain, "Edit Value", objectToEdit, index, parent, value);
+ IUndoableOperation operation = getEditStringValueOperation(editingDomain, "Edit Value", objectToEdit, index, parent, value); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ }
+ return command.reduce();
+ }
+
+ /**
+ * Returns the Operation to edit the String value
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param string
+ * the name of the command
+ * @param objectToEdit
+ * the object to edit
+ * @param index
+ * the index of the String to edit
+ * @param parent
+ * the composite parent
+ * @param value
+ * the value to set
+ * @return
+ * the Operation to edit the String value
+ */
+ protected IUndoableOperation getEditStringValueOperation(TransactionalEditingDomain editingDomain, String string, EObject objectToEdit, int index, Composite parent, Object value) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, string);
+ // get the feature to modify
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = value;
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ values.set(index, value);
+ newValue = values;
+ }
+ SetRequest[] requests = getSetRequest(editingDomain, objectToEdit, newValue);
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(objectToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ return command;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateEditValueOperation(List<? extends EObject> objectsToEdit) {
+ // try to retrieve editor for this property
+ // if one exists, return yes
+ // or try to open an inline-editor for simple values
+ return true;
+ }
+
+ /**
+ * Returns the feature ID
+ *
+ * @param feature
+ * the feature
+ * @param elementToEdit
+ * the element to edit
+ * @return
+ * the feature ID
+ */
+ protected int getFeatureID(EStructuralFeature feature, BasicEObjectImpl elementToEdit) {
+ return (elementToEdit).eDerivedStructuralFeatureID(feature);
+ }
+
+ /**
+ * Returns the structural feature of elementToEdit corresponding to this ID
+ *
+ * @param ID
+ * the ID of the feature
+ * @param elementToEdit
+ * the element to edit
+ * @return
+ * the structural feature of elementToEdit corresponding to this ID
+ */
+ protected EStructuralFeature getStructuralFeature(int ID, EObject elementToEdit) {
+ if(elementToEdit instanceof BasicEObjectImpl) {
+ EClass eClass = elementToEdit.eClass();
+ return eClass.getEStructuralFeature(ID);
+ }
+ return null;
+ }
+
+ // /**
+ // * Operation to edit a String value for the controlled property
+ // */
+ // protected class EditStringValueOperation extends AbstractTransactionalCommand {
+ //
+ // /** object to edit */
+ // protected final EObject objectToEdit;
+ //
+ // /** index of the value to edit */
+ // protected final int index;
+ //
+ // /** composite parent for the editor */
+ // protected final Composite parent;
+ //
+ // /** value to set */
+ // protected final Object value;
+ //
+ // /**
+ // * Initializes me with the editing domain, a label, transaction options, and
+ // * a list of {@link IFile}s that anticipate modifying when I am executed,
+ // * undone or redone.
+ // *
+ // * @param domain
+ // * the editing domain used to modify the model
+ // * @param label
+ // * my user-readable label, should never be <code>null</code>.
+ // * @param objectToEdit
+ // * object to edit
+ // * @param index
+ // * the index of the value to edit
+ // * @param parent
+ // * the graphical composite element
+ // * @param value
+ // */
+ // public EditStringValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit, int index, Composite parent, Object value) {
+ // super(domain, (label == null) ? "" : label, null);
+ // this.objectToEdit = objectToEdit;
+ // this.index = index;
+ // this.parent = parent;
+ // this.value = value;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // // get the feature to modify
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit == null) {
+ // return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ // }
+ // Object newValue;
+ // if(featureToEdit.getUpperBound() == 1) {
+ // newValue = value;
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ // values.set(index, value);
+ // newValue = values;
+ // }
+ // setValueInModel(objectToEdit, newValue);
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
+
+ // /**
+ // * Operation to edit a String value for the controlled property
+ // */
+ // protected class DeleteStringValueOperation extends AbstractTransactionalCommand {
+ //
+ // /** object to edit */
+ // protected final EObject objectToEdit;
+ //
+ // /** indexes of the value to delete */
+ // protected final List<Integer> indexes;
+ //
+ // /** composite parent for the editor */
+ // protected final Composite parent;
+ //
+ // /**
+ // * Initializes me with the editing domain, a label, transaction options, and
+ // * a list of {@link IFile}s that anticipate modifying when I am executed,
+ // * undone or redone.
+ // *
+ // * @param domain
+ // * the editing domain used to modify the model
+ // * @param label
+ // * my user-readable label, should never be <code>null</code>.
+ // * @param objectToEdit
+ // * object to edit
+ // * @param indexes
+ // * the indexes of the values to remove
+ // * @param parent
+ // * the graphical composite element
+ // */
+ // public DeleteStringValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit, List<Integer> indexes, Composite parent) {
+ // super(domain, (label == null) ? "" : label, null);
+ // this.objectToEdit = objectToEdit;
+ // this.indexes = indexes;
+ // this.parent = parent;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // // get the feature to modify
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit == null) {
+ // return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ // }
+ // Object newValue;
+ // if(featureToEdit.getUpperBound() == 1) {
+ // objectToEdit.eUnset(featureToEdit);
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ // for(int index : indexes) {
+ // values.remove(index);
+ // }
+ // newValue = values;
+ // setValueInModel(objectToEdit, newValue);
+ // }
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IUndoableOperation getMoveValueOperation(List<? extends EObject> objectsToEdit, List<Integer> indexes, Composite parent, int delta) {
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during move operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return null;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Move Values"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // MoveStringValueOperation operation = new MoveStringValueOperation(editingDomain, "Move Value", objectToEdit, indexes, parent, delta);
+ IUndoableOperation operation = getMoveStringValueOperation(editingDomain, "Move Value", objectToEdit, indexes, parent, delta); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ }
+ return command.reduce();
+ }
+
+ /**
+ * Returns the command to move String values
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param string
+ * the name of the command
+ * @param objectToEdit
+ * the object to edit
+ * @param indexes
+ * the index of the elements to move
+ * @param parent
+ * the composite parent
+ * @param delta
+ * the delta
+ * @return
+ * the command to move String values
+ */
+ protected IUndoableOperation getMoveStringValueOperation(TransactionalEditingDomain editingDomain, String string, EObject objectToEdit, List<Integer> indexes, Composite parent, int delta) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, string);
+ if(canMoveStringValue(objectToEdit, indexes, delta)) {
+
+ EClass eClass = objectToEdit.eClass();
+ if(eClass == null) {
+ return null;
+ }
+ // retrieve the current value (should be a list)
+ EStructuralFeature feature = getFeatureByName(objectToEdit);
+ Object currentValue = objectToEdit.eGet(feature);
+ if(currentValue instanceof List<?>) {
+ @SuppressWarnings("unchecked")
+ List<Object> values = (List<Object>)currentValue;
+ List<Object> copy = new ArrayList<Object>(values);
+ // make modification in copy list
+ // check indices
+ int min = copy.size();
+ int max = 0;
+
+ for(int index : indexes) {
+ if(index < min) {
+ min = index;
+ }
+ if(index > max) {
+ max = index;
+ }
+ }
+
+ // check that min and max are in the bounds of the list, with the
+ // delta applied
+ min += delta;
+ max += delta;
+ // check the bounds of the list
+ if(min < 0) {
+ Activator.log.debug("Trying to move up the elements, with a move which will cause an IndexOutOfBound exception"); //$NON-NLS-1$
+ return null;
+ } else if(max >= copy.size()) {
+ Activator.log.debug("Trying to move down the elements, with a move which will cause an IndexOutOfBound exception"); //$NON-NLS-1$
+ return null;
+ }
+
+ // now, do the move in the copy
+ if(delta < 0) {
+ moveUpElementsInCollection(copy, indexes, delta);
+ } else {
+ moveDownElementsOperation(copy, indexes, delta);
+ }
+
+ // setValueInModel(objectToEdit, copy);
+ SetRequest[] requests = getSetRequest(editingDomain, objectToEdit, copy);
+ if(requests != null) {
+
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(objectToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ }
+ }
+ }
+ return command;
+ }
+
+ /**
+ * Tests if we can move values
+ *
+ * @param objectToEdit
+ * the object to edit
+ * @param indexes
+ * the indexes
+ * @param delta
+ * the delta
+ * @return
+ * <code>true</code> if we can move the values <code>false</code> if not
+ */
+ protected boolean canMoveStringValue(EObject objectToEdit, List<Integer> indexes, int delta) {
+ EClass eClass = objectToEdit.eClass();
+ if(eClass == null) {
+ return false;
+ }
+ // retrieve the current value (should be a list)
+ EStructuralFeature feature = getFeatureByName(objectToEdit);
+ Object currentValue = objectToEdit.eGet(feature);
+ if(currentValue instanceof List<?>) {
+ @SuppressWarnings("unchecked")
+ List<Object> values = (List<Object>)currentValue;
+ List<Object> copy = new ArrayList<Object>(values);
+ // make modification in copy list
+ // check indices
+ int min = copy.size();
+ int max = 0;
+
+ for(int index : indexes) {
+ if(index < min) {
+ min = index;
+ }
+ if(index > max) {
+ max = index;
+ }
+ }
+
+ // check that min and max are in the bounds of the list, with the
+ // delta applied
+ min += delta;
+ max += delta;
+ // check the bounds of the list
+ if(min < 0) {
+ return false;
+ } else if(max >= copy.size()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreateMoveValueOperation(List<? extends EObject> objectsToEdit, List<Integer> indexes, Composite parent, int delta) {
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during move operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return false;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Move Values"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return false;
+ }
+ //MoveStringValueOperation operation = new MoveStringValueOperation(editingDomain, "Move Value", objectToEdit, indexes, parent, delta);
+ IUndoableOperation operation = getMoveStringValueOperation(editingDomain, "Move Value", objectToEdit, indexes, parent, delta); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ }
+ return command.canExecute();
+ }
+
+ /**
+ * Moves the element in the specified list, when the elements are moved down
+ * in the list
+ *
+ * @param modifiedElements
+ * list of elements modified
+ * @param indexes
+ * list of indexes of objects to move
+ * @param move
+ * delta for the move. should be positive integer
+ */
+ protected void moveDownElementsOperation(List<Object> modifiedElements, List<Integer> indexes, int move) {
+ // if moving down, starting from the end to move elements, assuming they
+ // are in the increasing order by default
+ Collections.sort(indexes);
+ Collections.reverse(indexes);
+ for(int index : indexes) {
+ Object objectToMove = modifiedElements.get(index);
+ // remove element
+ modifiedElements.remove(index);
+ // change index
+ if(index == -1) {
+ return;
+ }
+ index += move;
+ // add the element to the new index
+ modifiedElements.add(index, objectToMove);
+ }
+ }
+
+ /**
+ * Moves the element in the specified list, when the elements are moved up
+ * in the list
+ *
+ * @param modifiedElements
+ * list of elements modified
+ * @param indexes
+ * list of indexes of objects to move
+ * @param move
+ * delta for the move. should be positive integer
+ */
+ protected void moveUpElementsInCollection(List<Object> modifiedElements, List<Integer> indexes, int move) {
+ Collections.sort(indexes);
+ for(int index : indexes) {
+ // retrieve index
+ Object objectToMove = modifiedElements.get(index);
+ // remove element
+ modifiedElements.remove(index);
+ // change index
+ if(index == -1) {
+ return;
+ }
+ index += move;
+ // add the element to the new index
+ modifiedElements.add(index, objectToMove);
+ }
+ }
+
+ // /**
+ // * Operation to edit a String value for the controlled property
+ // */
+ // protected class MoveStringValueOperation extends AbstractTransactionalCommand {
+ //
+ // /** object to edit */
+ // protected final EObject objectToEdit;
+ //
+ // /** indexes of the value to delete */
+ // protected final List<Integer> indexes;
+ //
+ // /** composite parent for the editor */
+ // protected final Composite parent;
+ //
+ // /** delta applied to all indexes */
+ // protected final int delta;
+ //
+ // /**
+ // * Initializes me with the editing domain, a label, transaction options, and
+ // * a list of {@link IFile}s that anticipate modifying when I am executed,
+ // * undone or redone.
+ // *
+ // * @param domain
+ // * the editing domain used to modify the model
+ // * @param label
+ // * my user-readable label, should never be <code>null</code>.
+ // * @param objectToEdit
+ // * object to edit
+ // * @param indexes
+ // * the indexes of the values to remove
+ // * @param parent
+ // * the graphical composite element
+ // * @param delta
+ // * the delta applied to all indexes
+ // */
+ // public MoveStringValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit, List<Integer> indexes, Composite parent, int delta) {
+ // super(domain, (label == null) ? "" : label, null);
+ // this.objectToEdit = objectToEdit;
+ // this.indexes = indexes;
+ // this.parent = parent;
+ // this.delta = delta;
+ // }
+ //
+ // @Override
+ // public boolean canExecute() {
+ // EClass eClass = objectToEdit.eClass();
+ // if(eClass == null) {
+ // return false;
+ // }
+ // // retrieve the current value (should be a list)
+ // EStructuralFeature feature = getFeatureByName(objectToEdit);
+ // Object currentValue = objectToEdit.eGet(feature);
+ // if(currentValue instanceof List<?>) {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = (List<Object>)currentValue;
+ // List<Object> copy = new ArrayList<Object>(values);
+ // // make modification in copy list
+ // // check indices
+ // int min = copy.size();
+ // int max = 0;
+ //
+ // for(int index : indexes) {
+ // if(index < min) {
+ // min = index;
+ // }
+ // if(index > max) {
+ // max = index;
+ // }
+ // }
+ //
+ // // check that min and max are in the bounds of the list, with the
+ // // delta applied
+ // min += delta;
+ // max += delta;
+ // // check the bounds of the list
+ // if(min < 0) {
+ // return false;
+ // } else if(max >= copy.size()) {
+ // return false;
+ // }
+ // }
+ // return true;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // EClass eClass = objectToEdit.eClass();
+ // if(eClass == null) {
+ // return CommandResult.newErrorCommandResult("Impossible to find the EClass for object: " + objectToEdit);
+ // }
+ // // retrieve the current value (should be a list)
+ // EStructuralFeature feature = getFeatureByName(objectToEdit);
+ // Object currentValue = objectToEdit.eGet(feature);
+ // if(currentValue instanceof List<?>) {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = (List<Object>)currentValue;
+ // List<Object> copy = new ArrayList<Object>(values);
+ // // make modification in copy list
+ // // check indices
+ // int min = copy.size();
+ // int max = 0;
+ //
+ // for(int index : indexes) {
+ // if(index < min) {
+ // min = index;
+ // }
+ // if(index > max) {
+ // max = index;
+ // }
+ // }
+ //
+ // // check that min and max are in the bounds of the list, with the
+ // // delta applied
+ // min += delta;
+ // max += delta;
+ // // check the bounds of the list
+ // if(min < 0) {
+ // Activator.log.debug("Trying to move up the elements, with a move which will cause an IndexOutOfBound exception");
+ // return CommandResult.newErrorCommandResult("Trying to move up the elements, with a move which will cause an IndexOutOfBound exception");
+ // } else if(max >= copy.size()) {
+ // Activator.log.debug("Trying to move down the elements, with a move which will cause an IndexOutOfBound exception");
+ // return CommandResult.newErrorCommandResult("Trying to move down the elements, with a move which will cause an IndexOutOfBound exception");
+ // }
+ //
+ // // now, do the move in the copy
+ // if(delta < 0) {
+ // moveUpElementsInCollection(copy, indexes, delta);
+ // } else {
+ // moveDownElementsOperation(copy, indexes, delta);
+ // }
+ //
+ // setValueInModel(objectToEdit, copy);
+ // }
+ //
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFStereotypeFeatureModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFStereotypeFeatureModelHandler.java
index 34369de6a02..fe5203e4774 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFStereotypeFeatureModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFStereotypeFeatureModelHandler.java
@@ -8,9 +8,11 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
@@ -19,7 +21,10 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.papyrus.properties.runtime.controller.EMFPropertyEditorController;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
@@ -36,6 +41,38 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
private final String stereotypeName;
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addListenersToModel(List<? extends EObject> objectsToEdit, EMFPropertyEditorController controller) {
+ super.addListenersToModel(objectsToEdit, controller);
+ for(EObject object : objectsToEdit) {
+ if(object instanceof Element) {
+ Iterator<EObject> it = ((Element)object).getStereotypeApplications().iterator();
+ while(it.hasNext()) {
+ it.next().eAdapters().add(controller);
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeListenersFromModel(List<? extends EObject> objectsToEdit, EMFPropertyEditorController controller) {
+ super.removeListenersFromModel(objectsToEdit, controller);
+ for(EObject object : objectsToEdit) {
+ if(object instanceof Element) {
+ Iterator<EObject> it = ((Element)object).getStereotypeApplications().iterator();
+ while(it.hasNext()) {
+ it.next().eAdapters().remove(controller);
+ }
+ }
+ }
+ }
+
+ /**
* Creates a new EMFStereotypeFeatureModelHandler.
*
* @param stereotypeName
@@ -57,7 +94,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
if(objectToEdit instanceof Element) {
return EMFUtils.getStereotypeFeatureByName((Element)objectToEdit, retrieveStereotype((Element)objectToEdit), getFeatureName());
}
- Activator.log.error("Impossible to cast into UML element: " + objectToEdit, null);
+ Activator.log.error("Impossible to cast into UML element: " + objectToEdit, null); //$NON-NLS-1$
return null;
}
@@ -68,23 +105,23 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
public Object getAvailableValues(EObject eObject) {
EClass eClass = eObject.eClass();
if(eClass == null) {
- Activator.log.debug("problems during initialization, looking for availables values");
+ Activator.log.debug("problems during initialization, looking for availables values"); //$NON-NLS-1$
return null;
}
EStructuralFeature feature = getFeatureByName(eObject);
if(!(feature instanceof EReference)) {
- Activator.log.debug("feature is not a reference, looking for availables values: " + feature);
+ Activator.log.debug("feature is not a reference, looking for availables values: " + feature); //$NON-NLS-1$
return null;
}
IItemPropertySource itemPropertySource = (IItemPropertySource)factory.adapt(((Element)eObject).getStereotypeApplication(retrieveStereotype((Element)eObject)), IItemPropertySource.class);
if(itemPropertySource == null) {
- Activator.log.debug("impossible to find item Property source for " + retrieveStereotype((Element)eObject));
+ Activator.log.debug("impossible to find item Property source for " + retrieveStereotype((Element)eObject)); //$NON-NLS-1$
return null;
}
IItemPropertyDescriptor itemPropertyDescriptor = itemPropertySource.getPropertyDescriptor(retrieveStereotype((Element)eObject), feature);
if(itemPropertyDescriptor == null) {
- Activator.log.debug("impossible to find item Property descriptor for " + retrieveStereotype((Element)eObject) + " and " + feature);
+ Activator.log.debug("impossible to find item Property descriptor for " + retrieveStereotype((Element)eObject) + " and " + feature); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
return itemPropertyDescriptor.getChoiceOfValues(eObject);
@@ -96,7 +133,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
@Override
public Object getValueToEdit(EObject objectToEdit) {
if(!(objectToEdit instanceof Element)) {
- Activator.log.warn("the object to edit is not a UML2 Element: " + objectToEdit);
+ Activator.log.warn("the object to edit is not a UML2 Element: " + objectToEdit); //$NON-NLS-1$
return null;
}
Element elementToEdit = (Element)objectToEdit;
@@ -104,7 +141,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
if(stereotype != null) {
return getValueForElement(elementToEdit, stereotype);
} else {
- Activator.log.warn("Impossible to set value to the stereotype: " + stereotypeName + " on the element: " + elementToEdit);
+ Activator.log.warn("Impossible to get the stereotype: " + stereotypeName + " on the element: " + elementToEdit + " for feature " + getFeatureName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return null;
}
@@ -128,7 +165,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
@Override
public void setValueInModel(EObject objectToEdit, Object newValue) {
if(!(objectToEdit instanceof Element)) {
- Activator.log.warn("the object to edit is not a UML2 Element: " + objectToEdit);
+ Activator.log.warn("the object to edit is not a UML2 Element: " + objectToEdit); //$NON-NLS-1$
return;
}
Element elementToEdit = (Element)objectToEdit;
@@ -136,7 +173,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
if(stereotype != null) {
setValueForElement(elementToEdit, stereotype, newValue);
} else {
- Activator.log.warn("Impossible to set value to the stereotype: " + stereotypeName + " on the element: " + elementToEdit);
+ Activator.log.warn("Impossible to set value to the stereotype: " + stereotypeName + " on the element: " + elementToEdit); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -220,7 +257,7 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
EObject firstObject = objectToEdit.get(0);
if(!(firstObject instanceof Element)) {
- Activator.log.warn("Object to edit should be a UML2 element: " + firstObject);
+ Activator.log.warn("Object to edit should be a UML2 element: " + firstObject); //$NON-NLS-1$
return null;
}
@@ -244,14 +281,30 @@ public abstract class EMFStereotypeFeatureModelHandler extends EMFFeatureModelHa
return property;
}
}
- Activator.log.warn("No feature fond with name:" + getFeatureName() + " for stereotype " + stereotypeName);
+ Activator.log.warn("No feature fond with name:" + getFeatureName() + " for stereotype " + stereotypeName); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
/**
* {@inheritDoc}
*/
+ @Override
public IEMFModelHandlerState createState(boolean readOnly) {
return new EMFStereotypeFeatureModelHandlerState(this, readOnly);
}
+
+ /**
+ *
+ * @see org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler#getSetRequest(org.eclipse.emf.transaction.TransactionalEditingDomain,
+ * org.eclipse.emf.ecore.EObject, java.lang.Object)
+ *
+ * @param domain
+ * @param objectToEdit
+ * @param newValue
+ * @return
+ */
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue) {
+ return null; //TODO
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFUtils.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFUtils.java
index 6c2b5fd9012..90ef012180e 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFUtils.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EMFUtils.java
@@ -11,9 +11,15 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Element;
@@ -59,7 +65,8 @@ public class EMFUtils {
EObject eObject = elementToEdit.getStereotypeApplication(stereotype);
if(eObject == null) {
- throw new IllegalArgumentException(String.valueOf(stereotype));
+ Activator.log.error("Impossible to find stereotype application", null);
+ return null;
}
EClass eClass = eObject.eClass();
@@ -75,10 +82,32 @@ public class EMFUtils {
}
if(eStructuralFeature == null) {
- throw new IllegalArgumentException(String.valueOf(featureName));
+ Activator.log.error("Impossible to find structural feature", null);
+ return null;
}
return eStructuralFeature;
}
+ /**
+ * Returns the editing domain for a set of elements
+ *
+ * @param objects
+ * the objects from which the editing domain can be retrieved
+ * @return the editing domain found or <code>null</code>
+ */
+ public static TransactionalEditingDomain getTransactionalEditingDomain(List<? extends Object> objects) {
+ TransactionalEditingDomain editingDomain = null;
+ Iterator<? extends Object> it2 = objects.iterator();
+ while(it2.hasNext() && editingDomain == null) {
+ editingDomain = TransactionUtil.getEditingDomain(it2.next());
+ }
+
+ // if impossible to find editing domain this way: Tries the Papyrus service
+ if(editingDomain == null) {
+ editingDomain = EditorUtils.getTransactionalEditingDomain();
+ }
+ return editingDomain;
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationEMFModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationEMFModelHandler.java
index a4169e0d84e..9c54bd305e9 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationEMFModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationEMFModelHandler.java
@@ -8,20 +8,28 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IBoundedValuesPropertyEditorDescriptor;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.swt.widgets.Composite;
/**
* Model Handler for enumeration
@@ -40,7 +48,7 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
/** id of this model handler */
- public static final String ID = "Enumeration";
+ public static final String ID = "Enumeration"; //$NON-NLS-1$
/**
* {@inheritDoc}
@@ -58,13 +66,14 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
/**
* {@inheritDoc}
*/
+ @Override
public void setValueInModel(EObject objectToEdit, Object newValue) {
EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
if(featureToEdit == null) {
return;
}
// remove value if result of the editor is empty
- if(newValue == null || newValue.equals("")) {
+ if(newValue == null || newValue.equals("")) { //$NON-NLS-1$
objectToEdit.eUnset(featureToEdit);
} else {
// retrieve the real value for the enumeration
@@ -81,6 +90,7 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
/**
* {@inheritDoc}
*/
+ @Override
public void completeEditorDescriptor(IPropertyEditorDescriptor descriptor, List<? extends EObject> objectToEdit) {
if(objectToEdit.size() < 1) {
return;
@@ -96,7 +106,7 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
// check if there is an empty string at the beginning. there is one if the lower bound of the feature to edit equal 0
if(featureToEdit.getLowerBound() == 0) {
- values.add("");
+ values.add(""); //$NON-NLS-1$
}
if(featureToEdit.getEType() instanceof EEnum) {
@@ -108,7 +118,7 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
if(descriptor instanceof IBoundedValuesPropertyEditorDescriptor) {
((IBoundedValuesPropertyEditorDescriptor)descriptor).setAvailableValues(values);
} else {
- Activator.log.warn("Warning: " + descriptor + "could not be completed.");
+ Activator.log.warn("Warning: " + descriptor + "could not be completed."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -118,4 +128,217 @@ public class EnumerationEMFModelHandler extends EMFFeatureModelHandler {
public String getId() {
return ID;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent) {
+
+ List<IUndoableOperation> operations = new ArrayList<IUndoableOperation>(1);
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return null;
+ }
+ int indexOfNewValue = NEW_VALUE_NOT_SET_INDEX;
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Create new Enumeration Value"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // CreateEnumerationValueOperation operation = new CreateEnumerationValueOperation(editingDomain, "Create new Enumeration Value", objectToEdit);
+ IUndoableOperation operation = getCreateEnumerationValueOperation(editingDomain, "Create new Enumeration Value", objectToEdit); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ if(indexOfNewValue == NEW_VALUE_NOT_SET_INDEX) { // try to update
+ }
+ }
+
+ operations.add(command.reduce());
+
+ return operations;
+ }
+
+ /**
+ * Returns the command to edit the object
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param string
+ * the name of the command
+ * @param objectToEdit
+ * the object to edit
+ * @return
+ * the command to edit the object
+ */
+ protected IUndoableOperation getCreateEnumerationValueOperation(TransactionalEditingDomain editingDomain, String string, EObject objectToEdit) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, string);
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ Activator.log.error("Impossible to find the feature " + getFeatureName(), null); //$NON-NLS-1$
+ return command;
+ }
+
+ // create the value and add it to the feature
+ // if feature = simple valued => set
+ // if feature = multi valued => add at the end
+
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = getInitialValue(objectToEdit);
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ values.add(values.size(), getInitialValue(objectToEdit));
+ newValue = values;
+ }
+
+ SetRequest[] requests = getSetRequest(editingDomain, objectToEdit, newValue);
+ if(requests != null) {
+
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(objectToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ }
+ return command;
+ }
+
+ // /**
+ // * Operation to create a Enumeration value for the controlled property
+ // */
+ // protected class CreateEnumerationValueOperation extends AbstractTransactionalCommand {
+ //
+ // /** object to edit */
+ // protected final EObject objectToEdit;
+ //
+ // /** index of the value to add (-1 in case of single valued property) */
+ // private int indexOfNewValue = -2;
+ //
+ // /**
+ // * Initializes me with the editing domain, a label, transaction options, and
+ // * a list of {@link IFile}s that anticipate modifying when I am executed,
+ // * undone or redone.
+ // *
+ // * @param domain
+ // * the editing domain used to modify the model
+ // * @param label
+ // * my user-readable label, should never be <code>null</code>.
+ // * @param objectToEdit
+ // * the {@link EObject} to edit
+ // */
+ // public CreateEnumerationValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit) {
+ // super(domain, (label == null) ? "" : label, null);
+ // this.objectToEdit = objectToEdit;
+ //
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit.getUpperBound() == 1) {
+ // indexOfNewValue = -1;
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ // indexOfNewValue = values.size();
+ // }
+ // }
+ //
+ // /**
+ // * Returns the index at which the value will be added
+ // *
+ // * @return the index at which the value will be added
+ // */
+ // public int getIndexOfNewValue() {
+ // return indexOfNewValue;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // // create the value and add it to the feature
+ // // if feature = simple valued => set
+ // // if feature = multi valued => add at the end
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit == null) {
+ // return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ // }
+ // Object newValue;
+ // if(featureToEdit.getUpperBound() == 1) {
+ // newValue = getInitialValue(objectToEdit);
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ // values.add(indexOfNewValue, getInitialValue(objectToEdit));
+ // newValue = values;
+ // }
+ // setValueInModel(objectToEdit, newValue);
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
+
+ /**
+ * Returns the initial value for a new value of the feature
+ *
+ * @param objectToEdit
+ * the object to edit
+ *
+ * @return the initial value, not <code>null</code>
+ */
+ public Object getInitialValue(EObject objectToEdit) {
+ String featureName = getFeatureName();
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ return featureName;
+ } else {
+ EClassifier eClassifier = featureToEdit.getEType();
+ if(eClassifier instanceof EEnum) {
+ return ((EEnum)eClassifier).getDefaultValue();
+ } else if(Boolean.TYPE.isAssignableFrom(eClassifier.getInstanceClass())) {
+ return Boolean.TRUE;
+ }
+ Activator.log.error("Impossible to find a default value", null); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler#getSetRequest(org.eclipse.emf.transaction.TransactionalEditingDomain,
+ * org.eclipse.emf.ecore.EObject, java.lang.Object)
+ *
+ * @param domain
+ * @param objectToEdit
+ * @param newValue
+ * @return
+ */
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ // remove value if result of the editor is empty
+ if(newValue == null || newValue.equals("")) { //$NON-NLS-1$
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, featureToEdit.getDefaultValue()) };
+ } else {
+ // retrieve the real value for the enumeration
+ if(newValue instanceof String) {
+ EEnum type = (EEnum)featureToEdit.getEType();
+ EEnumLiteral literal = type.getEEnumLiteral((String)newValue);
+ Enumerator instance = literal.getInstance();
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, instance) };
+ }
+ }
+ return null;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationStereotypeModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationStereotypeModelHandler.java
index 59407200889..929af46cd96 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationStereotypeModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/EnumerationStereotypeModelHandler.java
@@ -14,11 +14,24 @@ package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IBoundedValuesPropertyEditorDescriptor;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
@@ -134,4 +147,133 @@ public class EnumerationStereotypeModelHandler extends EMFStereotypeFeatureModel
public String getId() {
return ID;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent) {
+ List<IUndoableOperation> operations = new ArrayList<IUndoableOperation>(1);
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null);
+ return null;
+ }
+ int indexOfNewValue = NEW_VALUE_NOT_SET_INDEX;
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Create new Enumeration Value");
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ CreateEnumerationStereotypeValueOperation operation = new CreateEnumerationStereotypeValueOperation(editingDomain, "Create new Enumeration Value", objectToEdit);
+ if(operation != null) {
+ command.add(operation);
+ }
+ if(indexOfNewValue == NEW_VALUE_NOT_SET_INDEX) { // try to update
+ indexOfNewValue = operation.getIndexOfNewValue();
+ }
+ }
+
+ operations.add(command.reduce());
+
+ return operations;
+ }
+
+ /**
+ * Operation to create a Enumeration value for the controlled property of a stererotype
+ */
+ protected class CreateEnumerationStereotypeValueOperation extends AbstractTransactionalCommand {
+
+ /** object to edit */
+ protected final EObject objectToEdit;
+
+ /** index of the value to add (-1 in case of single valued property) */
+ private int indexOfNewValue = -2;
+
+ /**
+ * Initializes me with the editing domain, a label, transaction options, and
+ * a list of {@link IFile}s that anticipate modifying when I am executed,
+ * undone or redone.
+ *
+ * @param domain
+ * the editing domain used to modify the model
+ * @param label
+ * my user-readable label, should never be <code>null</code>.
+ * @param objectToEdit
+ * the {@link EObject} to edit
+ */
+ public CreateEnumerationStereotypeValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit) {
+ super(domain, (label == null) ? "" : label, null);
+ this.objectToEdit = objectToEdit;
+
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ indexOfNewValue = -1;
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ indexOfNewValue = values.size();
+ }
+ }
+
+ /**
+ * Returns the index at which the value will be added
+ *
+ * @return the index at which the value will be added
+ */
+ public int getIndexOfNewValue() {
+ return indexOfNewValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // create the value and add it to the feature
+ // if feature = simple valued => set
+ // if feature = multi valued => add at the end
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ }
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = getInitialValue(objectToEdit);
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ values.add(indexOfNewValue, getInitialValue(objectToEdit));
+ newValue = values;
+ }
+ setValueInModel(objectToEdit, newValue);
+ return CommandResult.newOKCommandResult();
+ }
+ }
+
+ /**
+ * Returns the initial value for a new value of the feature
+ *
+ * @param objectToEdit
+ * the object to edit
+ *
+ * @return the initial value, not <code>null</code>
+ */
+ public Object getInitialValue(EObject objectToEdit) {
+ String featureName = getFeatureName();
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ return featureName;
+ } else {
+ for(int suffix = 0; suffix < 1000; suffix++) {
+ EClassifier eClassifier = featureToEdit.getEType();
+ if(eClassifier instanceof EEnum) {
+ return ((EEnum)eClassifier).getDefaultValue();
+ }
+ }
+ Activator.log.error("Impossible to find a default value", null);
+ return null;
+ }
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/IEMFModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/IEMFModelHandler.java
index 2d456ce2f2b..b42426d930e 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/IEMFModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/IEMFModelHandler.java
@@ -8,16 +8,21 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.properties.runtime.controller.EMFPropertyEditorController;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.eclipse.papyrus.properties.runtime.view.IConfigurableDescriptor;
+import org.eclipse.swt.widgets.Composite;
/**
@@ -117,4 +122,118 @@ public interface IEMFModelHandler extends IConfigurableDescriptor {
* the controller which was using this model handler
*/
public void removeListenersFromModel(List<? extends EObject> objectsToEdit, EMFPropertyEditorController controller);
+
+ /**
+ * Returns the operation to create a new value for this property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @param parent
+ * the composite parent, needed in case of user interaction
+ *
+ * @return the operation to create a new value for this property
+ */
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent);
+
+ /**
+ * Returns <code>true</code> if the controller can create a new value for the property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @return <code>true</code> if the controller can create a new value for the property
+ */
+ public boolean canCreateValueOperations(List<? extends EObject> objectsToEdit);
+
+ /**
+ * Returns the operation to delete a value for this property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @param parent
+ * the composite parent, needed in case of user interaction
+ * @param indexes
+ * list of indexes to delete
+ * @return the operation to delete a value for this property
+ *
+ */
+ public IUndoableOperation getDeleteValueOperation(List<? extends EObject> objectsToEdit, Composite parent, List<Integer> indexes);
+
+ /**
+ * Returns <code>true</code> if the controller can delete a value for the property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @return <code>true</code> if the controller can delete a value for the property
+ */
+ public boolean canCreateDeleteValueOperation(List<? extends EObject> objectsToEdit);
+
+ /**
+ * Returns the operation to edit a value for this property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @param index
+ * the index of the value to edit
+ * @param parent
+ * the parent for the editor
+ * @param value
+ * the value to set
+ * @return the operation to edit a value for this property
+ */
+ public IUndoableOperation getEditValueOperation(List<? extends EObject> objectsToEdit, int index, Composite parent, Object value);
+
+ /**
+ * Returns <code>true</code> if the controller can edit a value for the property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @return <code>true</code> if the controller can edit a value for the property
+ */
+ public boolean canCreateEditValueOperation(List<? extends EObject> objectsToEdit);
+
+ /**
+ * Returns the operation to move a list of values for this property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @param indexes
+ * the list of indexes to move
+ * @param parent
+ * the parent for the editor
+ * @param delta
+ * the delta applied to all moved objects
+ * @return the operation to edit a value for this property
+ */
+ public IUndoableOperation getMoveValueOperation(List<? extends EObject> objectsToEdit, List<Integer> indexes, Composite parent, int delta);
+
+ /**
+ * Returns <code>true</code> if the controller can move a set of values for the property
+ *
+ * @param objectsToEdit
+ * the list of object to edit
+ * @param indexes
+ * the list of indexes to move
+ * @param parent
+ * the parent for the editor
+ * @param delta
+ * the delta applied to all moved objects
+ * @return <code>true</code> if the controller can move a set of values for the property
+ */
+ public boolean canCreateMoveValueOperation(List<? extends EObject> objectsToEdit, List<Integer> indexes, Composite parent, int delta);
+
+
+
+ /**
+ * Returns a list of SetRequest for this object, or <code>null</code> if a request can't be created
+ *
+ * @param domain
+ * the transactional editing domain
+ * @param objectToEdit
+ * the object to edit
+ * @param newValue
+ * the new value for this object
+ * @return
+ * a list of SetRequest for this object, or <code>null</code> if a request can't be created
+ */
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue);
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceEMFModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceEMFModelHandler.java
index 73f87186442..2b8f7f20f19 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceEMFModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceEMFModelHandler.java
@@ -8,15 +8,38 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.utils.DisplayUtils;
import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.papyrus.properties.runtime.Messages;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
/**
@@ -35,11 +58,12 @@ public class ReferenceEMFModelHandler extends EMFFeatureModelHandler {
}
/** identifier fot this model handler */
- public static final String ID = "Reference";
+ public static final String ID = "Reference"; //$NON-NLS-1$
/**
* {@inheritDoc}
*/
+ @Override
public void setValueInModel(EObject objectToEdit, Object newValue) {
EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
if(featureToEdit == null) {
@@ -50,15 +74,15 @@ public class ReferenceEMFModelHandler extends EMFFeatureModelHandler {
} else if(newValue instanceof List<?>) {
objectToEdit.eSet(featureToEdit, newValue);
} else {
- Activator.log.error("impossible to set the new value", null);
+ Activator.log.error("impossible to set the new value", null); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
+ @Override
public void completeEditorDescriptor(IPropertyEditorDescriptor descriptor, List<? extends EObject> objectToEdit) {
-
}
/**
@@ -67,4 +91,214 @@ public class ReferenceEMFModelHandler extends EMFFeatureModelHandler {
public String getId() {
return ID;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(final List<? extends EObject> objectsToEdit, Composite parent) {
+ // checks the containment feature
+ EObject eObject = objectsToEdit.get(0);
+ EStructuralFeature feature = getFeatureByName(eObject);
+ if(!(feature instanceof EReference)) {
+ return new ArrayList<IUndoableOperation>();
+ }
+ // check containment feature
+
+ boolean isContainment = ((EReference)feature).isContainment();
+ if(isContainment) {
+ // retrieve the Eclass of the elements to edit
+ List<IUndoableOperation> undoableOperations = new ArrayList<IUndoableOperation>();
+ EClass eClass = eObject.eClass();
+ if(eClass == null) {
+ return undoableOperations;
+ }
+ // Use edit service and look for element types that are possible types of the selected EReference
+ List<IElementEditService> featureTypeServices;
+ try {
+ featureTypeServices = ElementEditServiceUtils.getEditServiceProvider().getContainedTypeEditServices(eObject, (EReference)feature);
+ } catch (ServiceException e) {
+ e.printStackTrace();
+ return undoableOperations;
+ }
+
+ for(IElementEditService featureTypeService : featureTypeServices) {
+ CreateElementRequest request = new CreateElementRequest(EMFUtils.getTransactionalEditingDomain(objectsToEdit), eObject, (IElementType)featureTypeService.getAdapter(IElementType.class), (EReference)feature);
+ request.setLabel(Messages.bind(Messages.EMFTEReferenceController_CreationOperationMenuLabel, featureTypeService.getDisplayName()));
+ ICommand command = featureTypeService.getEditCommand(request);
+ if(command.canExecute()) {
+ // adds it to the list of command that can be
+ // executed
+ undoableOperations.add(command);
+ }
+ }
+
+ return undoableOperations;
+ } else {
+
+ // IUndoableOperation operation = new FindReferenceCommand(EMFUtils.getTransactionalEditingDomain(objectsToEdit), "Find and Add references", objectsToEdit);
+ IUndoableOperation operation = getFindReferenceCommand(EMFUtils.getTransactionalEditingDomain(objectsToEdit), "Find and Add references", objectsToEdit); //$NON-NLS-1$
+ return Arrays.asList(operation);
+ }
+ }
+
+ /**
+ * Returns the command to find the reference
+ *
+ * @param transactionalEditingDomain
+ * the editing domain
+ * @param string
+ * the name of the command
+ * @param objectsToEdit
+ * the lists of objects to edit
+ * @return
+ * the command to find the reference
+ */
+ public IUndoableOperation getFindReferenceCommand(TransactionalEditingDomain transactionalEditingDomain, String string, List<? extends EObject> objectsToEdit) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(transactionalEditingDomain, string);
+ // checks the containment feature
+ EObject eObject = objectsToEdit.get(0);
+ EStructuralFeature feature = getFeatureByName(eObject);
+ if(!(feature instanceof EReference)) {
+ return command;
+ }
+
+ // pops up a window to ask for a new reference
+ Display display = Display.getCurrent();
+ if(display == null && PlatformUI.isWorkbenchRunning()) {
+ display = PlatformUI.getWorkbench().getDisplay();
+ }
+ display = (display != null) ? display : Display.getDefault();
+ EClassifier eclassifier = feature.getEType();
+ Object availableValues = getAvailableValues(eObject);
+ List<?> values = new ArrayList<Object>();
+ if(availableValues instanceof List<?>) {
+ values = (List<?>)availableValues;
+ } else if(availableValues instanceof Object[]) {
+ values = Arrays.asList(availableValues);
+ } else {
+ values = Arrays.asList(availableValues);
+ }
+
+ @SuppressWarnings("unchecked")
+ FeatureEditorDialog dialog = new FeatureEditorDialog(display.getActiveShell(), DisplayUtils.getLabelProvider(), eObject, eclassifier, (List<EObject>)eObject.eGet(feature), Messages.ReferenceEMFModelHandler_Select_Values, values, false, feature.isOrdered(), feature.isUnique());
+ // should select the current value by default
+ if(Dialog.OK == dialog.open()) {
+ @SuppressWarnings("unchecked")
+ List<EObject> currentValues = (List<EObject>)dialog.getResult();
+ SetRequest[] requests = getSetRequest(transactionalEditingDomain, eObject, currentValues);
+ if(requests != null) {
+
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(eObject);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ }
+ return command;
+ }
+
+ return command;
+ }
+
+ // /**
+ // * Command to create references.
+ // * Two cases:
+ // * - This is a containment reference, should create element.
+ // * - This is a simple reference, should only browse the model to get other elements
+ // */
+ // protected class FindReferenceCommand extends AbstractTransactionalCommand {
+ //
+ // /** list of objects to edit */
+ // protected final List<? extends EObject> objectsToEdit;
+ //
+ // /**
+ // * Creates a new FindReferenceCommand.
+ // *
+ // * @param domain
+ // * editing domain used to create or manipulate elements
+ // * @param label
+ // * the label of the command, used by UI.
+ // * @param objectsToEdit
+ // * the list of objects to edit
+ // */
+ // public FindReferenceCommand(TransactionalEditingDomain domain, String label, List<? extends EObject> objectsToEdit) {
+ // super(domain, label, null);
+ // this.objectsToEdit = objectsToEdit;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ //
+ // // checks the containment feature
+ // EObject eObject = objectsToEdit.get(0);
+ // EStructuralFeature feature = getFeatureByName(eObject);
+ // if(!(feature instanceof EReference)) {
+ // return CommandResult.newErrorCommandResult("the feature " + getFeatureName() + " is not a reference");
+ // }
+ //
+ // // pops up a window to ask for a new reference
+ // Display display = Display.getCurrent();
+ // if(display == null && PlatformUI.isWorkbenchRunning()) {
+ // display = PlatformUI.getWorkbench().getDisplay();
+ // }
+ // display = (display != null) ? display : Display.getDefault();
+ // EClassifier eclassifier = feature.getEType();
+ // Object availableValues = getAvailableValues(eObject);
+ // List<?> values = new ArrayList<Object>();
+ // if(availableValues instanceof List<?>) {
+ // values = (List<?>)availableValues;
+ // } else if(availableValues instanceof Object[]) {
+ // values = Arrays.asList(availableValues);
+ // } else {
+ // values = Arrays.asList(availableValues);
+ // }
+ //
+ // @SuppressWarnings("unchecked")
+ // FeatureEditorDialog dialog = new FeatureEditorDialog(display.getActiveShell(), DisplayUtils.getLabelProvider(), eObject, eclassifier, (List<EObject>)eObject.eGet(feature), "Select Values", values, false, feature.isOrdered(), feature.isUnique());
+ // // should select the current value by default
+ // if(Dialog.OK == dialog.open()) {
+ // @SuppressWarnings("unchecked")
+ // List<EObject> currentValues = (List<EObject>)dialog.getResult();
+ // eObject.eSet(feature, currentValues);
+ // }
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler#getSetRequest(org.eclipse.emf.transaction.TransactionalEditingDomain,
+ * org.eclipse.emf.ecore.EObject, java.lang.Object)
+ *
+ * @param domain
+ * @param objectToEdit
+ * @param newValue
+ * @return
+ */
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue) {
+
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ if(newValue instanceof EObject || newValue == null) {
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, newValue) };
+ } else if(newValue instanceof List<?>) {
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, newValue) };
+ } else {
+ Activator.log.error("impossible to set the new value", null); //$NON-NLS-1$
+ }
+ return null;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceStereotypeModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceStereotypeModelHandler.java
index 8d5a5f1f248..a89463a0ec6 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceStereotypeModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/ReferenceStereotypeModelHandler.java
@@ -11,9 +11,13 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.swt.widgets.Composite;
/**
@@ -57,4 +61,13 @@ public class ReferenceStereotypeModelHandler extends EMFStereotypeFeatureModelHa
public String getId() {
return ID;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringEMFModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringEMFModelHandler.java
index 6df6c32c7ab..47b30bd4cfd 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringEMFModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringEMFModelHandler.java
@@ -8,14 +8,24 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.swt.widgets.Composite;
/**
@@ -24,7 +34,7 @@ import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropert
public class StringEMFModelHandler extends EMFFeatureModelHandler {
/** ID of this model handler */
- public static final String ID = "String";
+ public static final String ID = "String"; //$NON-NLS-1$
/**
* Creates a new StringEMFModelHandler.
@@ -39,17 +49,38 @@ public class StringEMFModelHandler extends EMFFeatureModelHandler {
/**
* {@inheritDoc}
*/
+ @Override
public void setValueInModel(EObject objectToEdit, Object newValue) {
EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
if(featureToEdit == null) {
return;
}
- objectToEdit.eSet(featureToEdit, newValue);
+
+ // check the type of the feature to set
+ EClassifier type = featureToEdit.getEType();
+ if(type == null) {
+ Activator.log.debug("Impossible to find the type of the feature: " + getFeatureName()); //$NON-NLS-1$
+ } else {
+ if(String.class.isAssignableFrom(type.getInstanceClass())) {
+ objectToEdit.eSet(featureToEdit, newValue);
+ } else if(Integer.TYPE.isAssignableFrom(type.getInstanceClass())) {
+ try {
+ int value = Integer.parseInt(newValue.toString());
+ objectToEdit.eSet(featureToEdit, value);
+ } catch (NumberFormatException e) {
+ Activator.log.debug(newValue + " can not be parsed as an integer"); //$NON-NLS-1$
+ }
+ } else {
+ Activator.log.error("Feature: " + getFeatureName() + ". Impossible to understand the value for the type: " + featureToEdit.getEType().getInstanceClass(), null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
}
/**
* {@inheritDoc}
*/
+ @Override
public void completeEditorDescriptor(IPropertyEditorDescriptor descriptor, List<? extends EObject> objectToEdit) {
// nothing to do here
}
@@ -60,4 +91,237 @@ public class StringEMFModelHandler extends EMFFeatureModelHandler {
public String getId() {
return ID;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent) {
+ List<IUndoableOperation> operations = new ArrayList<IUndoableOperation>(1);
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null); //$NON-NLS-1$
+ return null;
+ }
+ // int indexOfNewValue = NEW_VALUE_NOT_SET_INDEX;
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Create new String Values"); //$NON-NLS-1$
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ //CreateStringValueOperation operation = new CreateStringValueOperation(editingDomain, "Create new String Value", objectToEdit);
+ IUndoableOperation operation = getCreateStringValueCommand(editingDomain, "Create new String Value", objectToEdit); //$NON-NLS-1$
+ if(operation != null) {
+ command.add(operation);
+ }
+ // if(indexOfNewValue == NEW_VALUE_NOT_SET_INDEX) { // try to update
+ // indexOfNewValue = operation.getIndexOfNewValue();
+ // }
+ }
+
+ operations.add(command.reduce());
+
+ return operations;
+ }
+
+ /**
+ * Returns the command to create a string value
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param string
+ * the command's name
+ * @param objectToEdit
+ * the object to edit
+ * @return
+ * The command to create a string value
+ */
+ protected IUndoableOperation getCreateStringValueCommand(TransactionalEditingDomain editingDomain, String string, EObject objectToEdit) {
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, string);
+ int indexOfNewValue = -2;
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return command;
+ }
+ if(featureToEdit.getUpperBound() == 1) {
+ indexOfNewValue = -1;
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)objectToEdit.eGet(featureToEdit));
+ indexOfNewValue = values.size();
+ }
+
+ // create the value and add it to the feature
+ // if feature = simple valued => set
+ // if feature = multi valued => add at the end
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = getInitialValue(objectToEdit);
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)objectToEdit.eGet(featureToEdit));
+ values.add(indexOfNewValue, getInitialValue(objectToEdit));
+ newValue = values;
+ }
+ SetRequest[] requests = getSetRequest(editingDomain, objectToEdit, newValue);
+ if(requests != null) {
+
+ org.eclipse.papyrus.service.edit.service.IElementEditService provider = org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils.getCommandProvider(objectToEdit);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : requests) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ command.add(editCommand);
+ }
+ }
+ }
+ }
+ return command;
+ }
+
+ // /**
+ // * Operation to create a String value for the controlled property
+ // */
+ // protected class CreateStringValueOperation extends AbstractTransactionalCommand {
+ //
+ // /** object to edit */
+ // protected final EObject objectToEdit;
+ //
+ // /** index of the value to add (-1 in case of single valued property) */
+ // private int indexOfNewValue = -2;
+ //
+ // /**
+ // * Initializes me with the editing domain, a label, transaction options, and
+ // * a list of {@link IFile}s that anticipate modifying when I am executed,
+ // * undone or redone.
+ // *
+ // * @param domain
+ // * the editing domain used to modify the model
+ // * @param label
+ // * my user-readable label, should never be <code>null</code>.
+ // * @param objectToEdit
+ // * the {@link EObject} to edit
+ // */
+ // public CreateStringValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit) {
+ // super(domain, (label == null) ? "" : label, null);
+ // this.objectToEdit = objectToEdit;
+ //
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit.getUpperBound() == 1) {
+ // indexOfNewValue = -1;
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)objectToEdit.eGet(featureToEdit));
+ // indexOfNewValue = values.size();
+ // }
+ // }
+ //
+ // /**
+ // * Returns the index at which the value will be added
+ // *
+ // * @return the index at which the value will be added
+ // */
+ // public int getIndexOfNewValue() {
+ // return indexOfNewValue;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // // create the value and add it to the feature
+ // // if feature = simple valued => set
+ // // if feature = multi valued => add at the end
+ // EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ // if(featureToEdit == null) {
+ // return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ // }
+ // Object newValue;
+ // if(featureToEdit.getUpperBound() == 1) {
+ // newValue = getInitialValue(objectToEdit);
+ // } else {
+ // @SuppressWarnings("unchecked")
+ // List<Object> values = new ArrayList<Object>((List<Object>)objectToEdit.eGet(featureToEdit));
+ // values.add(indexOfNewValue, getInitialValue(objectToEdit));
+ // newValue = values;
+ // }
+ // setValueInModel(objectToEdit, newValue);
+ // return CommandResult.newOKCommandResult();
+ // }
+ // }
+
+ /**
+ * Returns the initial value for a new value of the feature
+ *
+ * @param objectToEdit
+ * the object to edit
+ *
+ * @return the initial value, not <code>null</code>
+ */
+ public Object getInitialValue(EObject objectToEdit) {
+ String featureName = getFeatureName();
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ return featureName;
+ } else {
+ for(int suffix = 0; suffix < 1000; suffix++) {
+ String tmpName = featureName + suffix;
+ boolean found = false;
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)objectToEdit.eGet(featureToEdit));
+ for(Object value : values) {
+ if(tmpName.equals(value)) {
+ found = true;
+ }
+ }
+ if(!found) {
+ return tmpName;
+ }
+ }
+ return featureName;
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.properties.runtime.modelhandler.emf.IEMFModelHandler#getSetRequest(org.eclipse.emf.transaction.TransactionalEditingDomain,
+ * org.eclipse.emf.ecore.EObject, java.lang.Object)
+ *
+ * @param domain
+ * @param objectToEdit
+ * @param newValue
+ * @return
+ */
+ public SetRequest[] getSetRequest(TransactionalEditingDomain domain, EObject objectToEdit, Object newValue) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+
+ // check the type of the feature to set
+ EClassifier type = featureToEdit.getEType();
+ if(type == null) {
+ Activator.log.debug("Impossible to find the type of the feature: " + getFeatureName()); //$NON-NLS-1$
+ return null;
+ } else {
+ if(String.class.isAssignableFrom(type.getInstanceClass())) {
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, newValue) };
+ } else if(Integer.TYPE.isAssignableFrom(type.getInstanceClass())) {
+ try {
+ int value = Integer.parseInt(newValue.toString());
+ return new SetRequest[]{ new SetRequest(domain, objectToEdit, featureToEdit, value) };
+ } catch (NumberFormatException e) {
+ Activator.log.debug(newValue + " can not be parsed as an integer"); //$NON-NLS-1$
+ }
+ } else {
+ Activator.log.error("Feature: " + getFeatureName() + ". Impossible to understand the value for the type: " + featureToEdit.getEType().getInstanceClass(), null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return null;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringStereotypeModelHandler.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringStereotypeModelHandler.java
index befd5c32a86..70f4977ca3a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringStereotypeModelHandler.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/StringStereotypeModelHandler.java
@@ -11,6 +11,23 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.swt.widgets.Composite;
+
/**
* Model Handler for String-typed stereotypes properties
@@ -39,4 +56,139 @@ public class StringStereotypeModelHandler extends EMFStereotypeFeatureModelHandl
return ID;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<IUndoableOperation> getCreateValueOperations(List<? extends EObject> objectsToEdit, Composite parent) {
+ List<IUndoableOperation> operations = new ArrayList<IUndoableOperation>(1);
+ TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(objectsToEdit);
+ if(editingDomain == null) {
+ Activator.log.error("Impossible during creation operation to find the editing domain for objects: " + objectsToEdit, null);
+ return null;
+ }
+ int indexOfNewValue = NEW_VALUE_NOT_SET_INDEX;
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Create new String Values");
+ for(EObject objectToEdit : objectsToEdit) {
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return null;
+ }
+ CreateStringStererotypeValueOperation operation = new CreateStringStererotypeValueOperation(editingDomain, "Create new String Value", objectToEdit);
+ if(operation != null) {
+ command.add(operation);
+ }
+ if(indexOfNewValue == NEW_VALUE_NOT_SET_INDEX) { // try to update
+ indexOfNewValue = operation.getIndexOfNewValue();
+ }
+ }
+
+ operations.add(command.reduce());
+
+ return operations;
+ }
+
+ /**
+ * Operation to create a String value for the controlled property of a stereotype
+ */
+ protected class CreateStringStererotypeValueOperation extends AbstractTransactionalCommand {
+
+ /** object to edit */
+ protected final EObject objectToEdit;
+
+ /** index of the value to add (-1 in case of single valued property) */
+ private int indexOfNewValue = -2;
+
+ /**
+ * Initializes me with the editing domain, a label, transaction options, and
+ * a list of {@link IFile}s that anticipate modifying when I am executed,
+ * undone or redone.
+ *
+ * @param domain
+ * the editing domain used to modify the model
+ * @param label
+ * my user-readable label, should never be <code>null</code>.
+ * @param objectToEdit
+ * the {@link EObject} to edit
+ */
+ public CreateStringStererotypeValueOperation(TransactionalEditingDomain domain, String label, EObject objectToEdit) {
+ super(domain, (label == null) ? "" : label, null);
+ this.objectToEdit = objectToEdit;
+
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ indexOfNewValue = -1;
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ indexOfNewValue = values.size();
+ }
+ }
+
+ /**
+ * Returns the index at which the value will be added
+ *
+ * @return the index at which the value will be added
+ */
+ public int getIndexOfNewValue() {
+ return indexOfNewValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // create the value and add it to the feature
+ // if feature = simple valued => set
+ // if feature = multi valued => add at the end
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit == null) {
+ return CommandResult.newErrorCommandResult("Impossible to find the feature " + getFeatureName());
+ }
+ Object newValue;
+ if(featureToEdit.getUpperBound() == 1) {
+ newValue = getInitialValue(objectToEdit);
+ } else {
+ @SuppressWarnings("unchecked")
+ List<Object> values = (List<Object>)getValueToEdit(objectToEdit);
+ values.add(indexOfNewValue, getInitialValue(objectToEdit));
+ newValue = values;
+ }
+ setValueInModel(objectToEdit, newValue);
+ return CommandResult.newOKCommandResult();
+ }
+ }
+
+ /**
+ * Returns the initial value for a new value of the feature
+ *
+ * @param objectToEdit
+ * the object to edit
+ *
+ * @return the initial value, not <code>null</code>
+ */
+ public Object getInitialValue(EObject objectToEdit) {
+ String featureName = getFeatureName();
+ EStructuralFeature featureToEdit = getFeatureByName(objectToEdit);
+ if(featureToEdit.getUpperBound() == 1) {
+ return featureName;
+ } else {
+ for(int suffix = 0; suffix < 1000; suffix++) {
+ String tmpName = featureName + suffix;
+ boolean found = false;
+ @SuppressWarnings("unchecked")
+ List<Object> values = new ArrayList<Object>((List<Object>)getValueToEdit(objectToEdit));
+ for(Object value : values) {
+ if(tmpName.equals(value)) {
+ found = true;
+ }
+ }
+ if(!found) {
+ return tmpName;
+ }
+ }
+ return featureName;
+ }
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/TransactionUtil.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/TransactionUtil.java
new file mode 100644
index 00000000000..fd8b0f71007
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/modelhandler/emf/TransactionUtil.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.modelhandler.emf;
+
+import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.InternalTransaction;
+import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
+
+
+/**
+ * Utility class for transactions
+ */
+public class TransactionUtil {
+
+ /**
+ * Checks if the current active transaction is a Write transaction or not
+ * unprotected transaction are not considered write transaction
+ *
+ * @param internalEditingDomain
+ * the current internal editing domain, on which transaction are run
+ * @param includeUnprotected
+ * <code>boolean</code> value that if <code>true</code> will consider unprotected
+ * transactions when determining if a write transaction is in progress.
+ * @param otherThread
+ * <code>boolean</code> value that if <code>true</code>, will verify whether there is
+ * an active transaction only when on a different thread then the caller. This is useful to determine if a
+ * deadlock scenario will occur.
+ * @return <code>true</code> if the current active transaction is a write transaction
+ */
+ public static boolean isReadTransactionInProgress(TransactionalEditingDomain internalEditingDomain, boolean includeUnprotected, boolean otherThread) {
+ if(!(internalEditingDomain instanceof InternalTransactionalEditingDomain)) {
+ return false;
+ }
+
+ InternalTransaction transaction = ((InternalTransactionalEditingDomain)internalEditingDomain).getActiveTransaction();
+ if(transaction != null && transaction.isReadOnly()) {
+ if(includeUnprotected) {
+ Object unprotectedMode = transaction.getOptions().get(Transaction.OPTION_UNPROTECTED);
+ if(Boolean.FALSE.equals(unprotectedMode)) {
+ return false;
+ }
+ }
+
+ if(otherThread && Thread.currentThread() != transaction.getOwner())
+ return true;
+ else if(!otherThread) {
+ return true;
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java
new file mode 100644
index 00000000000..0565622d780
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/AbstractTablePropertyEditor.java
@@ -0,0 +1,497 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.papyrus.properties.runtime.controller.ILabelProviderController;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+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.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Abstract class for all table editors
+ */
+public abstract class AbstractTablePropertyEditor extends AbstractPropertyEditor {
+
+ /** main composite created by this property editor */
+ protected Composite composite;
+
+ /** button to add a reference or modify existing one */
+ protected Button addButton;
+
+ /** button to remove reference */
+ protected Button removeButton;
+
+ /** table area that displays the values */
+ protected Table table;
+
+ /** viewer on the previous table */
+ protected TableViewer viewer;
+
+ /** current Value in the editor */
+ protected List<Object> currentValue;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Composite createContent(Composite parent) {
+ composite = getWidgetFactory().createComposite(parent, SWT.NONE);
+ int columnNu = getColumnNumber();
+ GridLayout layout = new GridLayout(columnNu, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ composite.setLayoutData(data);
+
+ // creates label. No TOP/DOWN/etc. position, always on top
+ createLabel(composite);
+
+ if(!getIsReadOnly()) {
+ // create Button area
+ addButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ addButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Add_12x12.gif")));
+ data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ addButton.setLayoutData(data);
+ addButton.addMouseListener(new MouseListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ performAddButtonPressed();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ });
+
+ removeButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ removeButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Delete_12x12.gif")));
+ data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ removeButton.setLayoutData(data);
+ removeButton.addMouseListener(new MouseListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ performRemoveButtonPressed();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+
+ }
+ });
+
+ if(getController().canMoveValues(new ArrayList<Integer>(), 0)) { // only checks if virtual elements can be moved, not real move, so a 0-delta is fine
+ Button upButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ upButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Up_12x12.gif")));
+ data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ upButton.setLayoutData(data);
+ upButton.addMouseListener(new MouseListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ performUpButtonPressed();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ });
+
+ Button downButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ downButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Down_12x12.gif")));
+ data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ downButton.setLayoutData(data);
+ downButton.addMouseListener(new MouseListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ performDownButtonPressed();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ });
+ }
+ }
+
+ Composite tableComposite = getWidgetFactory().createComposite(composite, SWT.NONE);
+ data = new GridData(SWT.FILL, SWT.FILL, true, true, columnNu, 1);
+ data.heightHint = 80;
+ data.widthHint = 200;
+ tableComposite.setLayoutData(data);
+ // creates table for the display of references
+ table = new Table(tableComposite, SWT.BORDER | SWT.MULTI);
+ viewer = new TableViewer(table);
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableComposite.setLayout(tableLayout);
+ final TableViewerColumn tableViewerColumn = new TableViewerColumn(viewer, SWT.NONE);
+ TableColumn tableColumn = tableViewerColumn.getColumn();
+ tableLayout.setColumnData(tableColumn, new ColumnWeightData(100, 0, true));
+ tableColumn.setText("Value");
+ tableViewerColumn.setEditingSupport(createEditingSupport());
+ viewer.setUseHashlookup(true);
+ viewer.setContentProvider(new IStructuredContentProvider() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List<?>) {
+ return ((List<?>)inputElement).toArray();
+ }
+ return new Object[0];
+ }
+ });
+
+ if(getController() instanceof ILabelProviderController) {
+ viewer.setLabelProvider(((ILabelProviderController)getController()).getEditorLabelProvider());
+ } else {
+ viewer.setLabelProvider(new LabelProvider());
+ }
+ viewer.getControl().setToolTipText(getTooltipText());
+ return composite;
+ }
+
+ /**
+ * Creates the editing support for the table viewer
+ *
+ * @return the editing support for the table viewer
+ */
+ protected abstract EditingSupport createEditingSupport();
+
+ /**
+ * performs the action handled by the "Add" button
+ */
+ protected void performAddButtonPressed() {
+ // pops up a window to ask for a new reference
+ Display display = Display.getCurrent();
+ if(display == null && PlatformUI.isWorkbenchRunning()) {
+ display = PlatformUI.getWorkbench().getDisplay();
+ }
+ display = (display != null) ? display : Display.getDefault();
+
+ List<IUndoableOperation> operations = getController().getCreateValueOperations();
+
+ // either one or more options
+ // in case there are several, open a sub-menu
+ // otherwise, execute the operation
+ if(operations == null || operations.isEmpty()) {
+ return;
+ }
+ if(operations.size() == 1) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(operations.get(0), new NullProgressMonitor(), null);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ } else {
+ Menu menu = new Menu(addButton);
+ for(final IUndoableOperation operation : operations) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(operation.getLabel());
+ item.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ }
+ menu.setVisible(true);
+ }
+
+ // now select the new value added. Assumes this is the last one
+ int lastIndex = table.getItemCount() - 1;
+ table.select(lastIndex);
+
+ }
+
+ /**
+ * performs the action handled by the "Remove" button
+ */
+ protected void performRemoveButtonPressed() {
+ // use selection to remove element
+ // retrieve selected element(s)
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ if(selection == null || selection.isEmpty()) {
+ // nothing selected.
+ return;
+ }
+
+ int[] selectedIndexes = table.getSelectionIndices();
+ Arrays.sort(selectedIndexes);
+ List<Integer> indexes = new ArrayList<Integer>();
+ for(int i = selectedIndexes.length - 1; i >= 0; i--) {
+ indexes.add(selectedIndexes[i]);
+ }
+ IUndoableOperation operation = getController().getDeleteValueOperation(indexes);
+ if(operation != null && operation.canExecute()) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ /**
+ * performs the action handled by the "Up" button
+ */
+ protected void performUpButtonPressed() {
+ int[] selectionIndices = table.getSelectionIndices();
+ final List<Integer> selectionList = new ArrayList<Integer>();
+ final List<Integer> newSelectionList = new ArrayList<Integer>();
+ for(int i : selectionIndices) {
+ selectionList.add(i);
+ newSelectionList.add(i - 1);
+ }
+ IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, -1);
+ if(moveOperation != null && moveOperation.canExecute()) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // try to restore selection in the view
+ int[] newSelection = new int[newSelectionList.size()];
+ for(int i = 0; i < newSelectionList.size(); i++) {
+ newSelection[i] = newSelectionList.get(i);
+ }
+ table.select(newSelection);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ /**
+ * performs the action handled by the "Down" button
+ */
+ protected void performDownButtonPressed() {
+ // use selection to remove element
+ // retrieve selected element(s)
+ int[] selectionIndices = table.getSelectionIndices();
+ final List<Integer> selectionList = new ArrayList<Integer>();
+ final List<Integer> newSelectionList = new ArrayList<Integer>();
+ for(int i : selectionIndices) {
+ selectionList.add(i);
+ newSelectionList.add(i + 1);
+ }
+ IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, +1);
+ if(moveOperation != null && moveOperation.canExecute()) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // try to restore selection in the view
+ int[] newSelection = new int[newSelectionList.size()];
+ for(int i = 0; i < newSelectionList.size(); i++) {
+ newSelection[i] = newSelectionList.get(i);
+ }
+ table.select(newSelection);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Control createLabel(Composite parent) {
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ return createLabel(parent, data);
+ }
+
+ /**
+ * Returns the number of column for the composite
+ *
+ * @return the number of column for the composite
+ */
+ protected int getColumnNumber() {
+ if(getIsReadOnly()) {
+ return 1;
+ }
+ if(getController().canMoveValues(new ArrayList<Integer>(), 0)) {
+ return 5;
+ }
+ return 3;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void handleContentChanged() {
+ // this should tells the controller that the input has to be applied to the model
+ getController().updateModel();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IStatus init(IPropertyEditorDescriptor descriptor) {
+ setDescriptor(descriptor);
+ setTooltipText(descriptor.getTooltipText());
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Object> getValue() {
+ return currentValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setValue(Object valueToEdit) {
+ if(!isValid(table)) {
+ return;
+ }
+ if(valueToEdit instanceof List<?>) {
+ currentValue = (List<Object>)valueToEdit;
+ } else if(valueToEdit == null) {
+ currentValue = null;
+ } else {
+ Activator.log.error(valueToEdit + " is not a list of Object for current table: " + getDescriptor().getLabel(), null);
+ }
+ viewer.setInput((currentValue != null) ? currentValue : Collections.emptyList());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ if(isValid(composite)) {
+ composite.dispose();
+ composite = null;
+ setController(null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDisposed() {
+ if(composite == null) {
+ return true;
+ }
+ return composite.isDisposed();
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java
new file mode 100644
index 00000000000..d33186de1e5
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditor.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.papyrus.properties.runtime.Activator;
+
+
+/**
+ * Property editor for Primitive typed-properties
+ */
+public class MultiplePrimitiveTypedPropertyEditor extends AbstractTablePropertyEditor {
+
+ /** id of this editor */
+ public static final String ID = "org.eclipse.papyrus.properties.runtime.multiplePrimitiveTypedPropertyEditor";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected EditingSupport createEditingSupport() {
+ return new StringEditingSupport(viewer);
+ }
+
+ /**
+ * Editing support for the viewer
+ */
+ protected class StringEditingSupport extends EditingSupport {
+
+ /**
+ * Creates a new StringEditingSupport.
+ *
+ * @param viewer
+ * the viewer in which this suport is added
+ */
+ public StringEditingSupport(ColumnViewer viewer) {
+ super(viewer);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return new TextCellEditor(table);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getValue(Object element) {
+ return element;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setValue(Object element, Object value) {
+ // retrieve the index of the element in the list of values
+ int index = viewer.getTable().getSelectionIndex();
+ // retrieves the operation to set the value
+ IUndoableOperation operation = getController().getEditValueOperation(index, table, value);
+ if(operation != null && operation.canExecute()) {
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditorValidator.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditorValidator.java
new file mode 100644
index 00000000000..5a355f9488b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultiplePrimitiveTypedPropertyEditorValidator.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor;
+
+/**
+ * Validator for {@link MultiplePrimitiveTypedPropertyEditor}
+ */
+public class MultiplePrimitiveTypedPropertyEditorValidator implements IPropertyEditorTypeValidator {
+
+ /** editor fo which this validator is installed */
+ protected AbstractPropertyEditor editor;
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isValidForValue(Object valueToEdit) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setPropertyEditor(AbstractPropertyEditor editor) {
+ this.editor = editor;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
index bdc78d15f09..8952f5c628a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleReferencePropertyEditor.java
@@ -11,347 +11,270 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.propertyeditor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.properties.runtime.Activator;
-import org.eclipse.papyrus.properties.runtime.controller.EMFTStructuralFeatureController;
+import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.papyrus.properties.runtime.controller.IBoundedValuesController;
-import org.eclipse.papyrus.properties.runtime.controller.IWizardPropertyEditorController;
import org.eclipse.papyrus.properties.runtime.controller.PropertyEditorController;
-import org.eclipse.papyrus.properties.runtime.modelhandler.emf.EMFFeatureModelHandler;
-import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.PlatformUI;
/**
* Property editor for references that have multiplicity [n..*]
*/
-public class MultipleReferencePropertyEditor extends AbstractPropertyEditor {
+public class MultipleReferencePropertyEditor extends AbstractTablePropertyEditor {
/** id of this editor */
public static final String ID = "org.eclipse.papyrus.properties.runtime.multipleReferencePropertyEditor";
- /** main composite created by this property editor */
- protected Composite composite;
-
- /** button to add a reference or modify existing one */
- protected Button addButton;
-
- /** button to remove reference */
- protected Button removeButton;
-
- /** table area that displays the reference name or toString */
- protected Table referenceArea;
-
- /** table area that displays the reference name or toString */
- protected TableViewer referencesViewer;
-
- /** current Value */
- protected List<EObject> currentValue;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Composite createContent(Composite parent) {
- composite = getWidgetFactory().createComposite(parent, SWT.NONE);
- int columnNu = getColumnNumber();
- GridLayout layout = new GridLayout(columnNu, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- composite.setLayoutData(data);
-
- // creates label. No TOP/DOWN/etc. position, always on top
- createLabel(composite);
-
- if(!getIsReadOnly()) {
- // create Button area
- addButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- addButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Add_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- addButton.setLayoutData(data);
- addButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- // pops up a window to ask for a new reference
- Display display = Display.getCurrent();
- if(display == null && PlatformUI.isWorkbenchRunning()) {
- display = PlatformUI.getWorkbench().getDisplay();
- }
- display = (display != null) ? display : Display.getDefault();
-
- // FIXME: specific part to use with EMF properties... should be moved inside the controller ?!
- EObject eObject = ((EMFTStructuralFeatureController)getController()).getObjectsToEdit().get(0);
- EMFFeatureModelHandler handler = (EMFFeatureModelHandler)((EMFTStructuralFeatureController)getController()).getModelHandler();
- EStructuralFeature feature = handler.getFeatureByName(eObject);
- EClassifier eclassifier = feature.getEType();
- Object availableValues = ((IBoundedValuesController)getController()).getAvailableValues();
- List<?> values = new ArrayList<Object>();
- if(availableValues instanceof List<?>) {
- values = (List<?>)availableValues;
- } else if(availableValues instanceof Object[]) {
- values = Arrays.asList(availableValues);
- } else {
- values = Arrays.asList(availableValues);
- }
- FeatureEditorDialog dialog = new FeatureEditorDialog(display.getActiveShell(), ((IBoundedValuesController)getController()).getBrowserLabelProvider(), eObject, eclassifier, getValue(), "Select " + getController().getPropertyEditor().getDescriptor().getLabel(), values, false, feature.isOrdered(), feature.isUnique());
- // should select the current value by default
- if(Dialog.OK == dialog.open()) {
- currentValue = (List<EObject>)dialog.getResult();
- // now, apply the new value
- getController().updateModel();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- removeButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- removeButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Delete_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- removeButton.setLayoutData(data);
- removeButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- public void mouseUp(MouseEvent e) {
- if(!(getController() instanceof IWizardPropertyEditorController)) {
- return;
- }
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
-
- // copy current value
- List<EObject> values = new ArrayList<EObject>(currentValue);
- // remove selected elements from values
- values.removeAll(selection.toList());
-
- currentValue = values;
- getController().updateModel();
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- if(((IBoundedValuesController)getController()).canMoveValues()) {
- Button upButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- upButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Up_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- upButton.setLayoutData(data);
- upButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- public void mouseUp(MouseEvent e) {
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
- @SuppressWarnings("unchecked")
- List<Object> selectedObjects = selection.toList();
- IUndoableOperation moveOperation = ((IBoundedValuesController)getController()).getMoveCurrentValuesOperation(selectedObjects, -1);
- if(moveOperation != null && moveOperation.canExecute()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- } finally {
- // try to restore selection in the view
- referencesViewer.setSelection(selection, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- Button downButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- downButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Down_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- downButton.setLayoutData(data);
- downButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- public void mouseUp(MouseEvent e) {
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
- @SuppressWarnings("unchecked")
- List<Object> selectedObjects = selection.toList();
- IUndoableOperation moveOperation = ((IBoundedValuesController)getController()).getMoveCurrentValuesOperation(selectedObjects, +1);
- if(moveOperation != null && moveOperation.canExecute()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- } finally {
- // try to restore selection in the view
- referencesViewer.setSelection(selection, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
- }
- }
-
- // creates table for the display of references
- referenceArea = new Table(composite, SWT.BORDER | SWT.MULTI);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, columnNu, 1);
- data.heightHint = 80;
- referenceArea.setLayoutData(data);
- referencesViewer = new TableViewer(referenceArea);
- referencesViewer.setContentProvider(new IStructuredContentProvider() {
-
- /**
- * {@inheritDoc}
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof List<?>) {
- return ((List<?>)inputElement).toArray();
- }
- return new Object[0];
- }
- });
- referencesViewer.setLabelProvider(((IBoundedValuesController)getController()).getEditorLabelProvider());
-
- referencesViewer.getControl().setToolTipText(getTooltipText());
-
- return composite;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createLabel(Composite parent) {
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
- return createLabel(parent, data);
- }
-
- /**
- * Returns the number of column for the composite
- *
- * @return the number of column for the composite
- */
- protected int getColumnNumber() {
- if(getIsReadOnly()) {
- return 1;
- }
- if(((IBoundedValuesController)getController()).canMoveValues()) {
- return 5;
- }
- return 3;
- }
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public Composite createContent(Composite parent) {
+ // composite = getWidgetFactory().createComposite(parent, SWT.NONE);
+ // int columnNu = getColumnNumber();
+ // GridLayout layout = new GridLayout(columnNu, false);
+ // layout.marginHeight = 0;
+ // layout.marginWidth = 0;
+ // composite.setLayout(layout);
+ // GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ // composite.setLayoutData(data);
+ //
+ // // creates label. No TOP/DOWN/etc. position, always on top
+ // createLabel(composite);
+ //
+ // if(!getIsReadOnly()) {
+ // // create Button area
+ // addButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ // addButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Add_12x12.gif")));
+ // data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ // addButton.setLayoutData(data);
+ // addButton.addMouseListener(new MouseListener() {
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @SuppressWarnings("unchecked")
+ // public void mouseUp(MouseEvent e) {
+ // PER
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDown(MouseEvent e) {
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDoubleClick(MouseEvent e) {
+ // }
+ // });
+ //
+ // removeButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ // removeButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Delete_12x12.gif")));
+ // data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ // removeButton.setLayoutData(data);
+ // removeButton.addMouseListener(new MouseListener() {
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseUp(MouseEvent e) {
+ // if(!(getController() instanceof IWizardPropertyEditorController)) {
+ // return;
+ // }
+ // // use selection to remove element
+ // // retrieve selected element(s)
+ // IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
+ // if(selection == null || selection.isEmpty()) {
+ // // nothing selected.
+ // return;
+ // }
+ //
+ // // copy current value
+ // List<EObject> values = new ArrayList<EObject>(currentValue);
+ // // remove selected elements from values
+ // values.removeAll(selection.toList());
+ //
+ // currentValue = values;
+ // getController().updateModel();
+ //
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDown(MouseEvent e) {
+ //
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDoubleClick(MouseEvent e) {
+ //
+ // }
+ // });
+ //
+ // if(getController().canMoveValues(new ArrayList<Integer>(), 0)) { // only checks if elements can be moved, not real move, so a 0-delta is fine
+ // Button upButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ // upButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Up_12x12.gif")));
+ // data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ // upButton.setLayoutData(data);
+ // upButton.addMouseListener(new MouseListener() {
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseUp(MouseEvent e) {
+ // int[] selectionIndices = referencesViewer.getTable().getSelectionIndices();
+ // final List<Integer> selectionList = new ArrayList<Integer>();
+ // final List<Integer> newSelectionList = new ArrayList<Integer>();
+ // for(int i : selectionIndices) {
+ // selectionList.add(i);
+ // newSelectionList.add(i - 1);
+ // }
+ // IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, -1);
+ // if(moveOperation != null && moveOperation.canExecute()) {
+ // try {
+ // OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // // try to restore selection in the view
+ // int[] newSelection = new int[newSelectionList.size()];
+ // for(int i = 0; i < newSelectionList.size(); i++) {
+ // newSelection[i] = newSelectionList.get(i);
+ // }
+ // referencesViewer.getTable().select(newSelection);
+ // } catch (ExecutionException e1) {
+ // Activator.log.error(e1);
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDown(MouseEvent e) {
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDoubleClick(MouseEvent e) {
+ // }
+ // });
+ //
+ // Button downButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
+ // downButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Down_12x12.gif")));
+ // data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ // downButton.setLayoutData(data);
+ // downButton.addMouseListener(new MouseListener() {
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseUp(MouseEvent e) {
+ // // use selection to remove element
+ // // retrieve selected element(s)
+ // int[] selectionIndices = referencesViewer.getTable().getSelectionIndices();
+ // final List<Integer> selectionList = new ArrayList<Integer>();
+ // final List<Integer> newSelectionList = new ArrayList<Integer>();
+ // for(int i : selectionIndices) {
+ // selectionList.add(i);
+ // newSelectionList.add(i + 1);
+ // }
+ // IUndoableOperation moveOperation = getController().getMoveCurrentValuesOperation(selectionList, +1);
+ // if(moveOperation != null && moveOperation.canExecute()) {
+ // try {
+ // OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
+ // // try to restore selection in the view
+ // int[] newSelection = new int[newSelectionList.size()];
+ // for(int i = 0; i < newSelectionList.size(); i++) {
+ // newSelection[i] = newSelectionList.get(i);
+ // }
+ // referencesViewer.getTable().select(newSelection);
+ // } catch (ExecutionException e1) {
+ // Activator.log.error(e1);
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDown(MouseEvent e) {
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void mouseDoubleClick(MouseEvent e) {
+ // }
+ // });
+ // }
+ // }
+ //
+ // // creates table for the display of references
+ // referenceArea = new Table(composite, SWT.BORDER | SWT.MULTI);
+ // data = new GridData(SWT.FILL, SWT.FILL, true, true, columnNu, 1);
+ // data.heightHint = 80;
+ // referenceArea.setLayoutData(data);
+ // referencesViewer = new TableViewer(referenceArea);
+ // referencesViewer.setContentProvider(new IStructuredContentProvider() {
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public void dispose() {
+ //
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public Object[] getElements(Object inputElement) {
+ // if(inputElement instanceof List<?>) {
+ // return ((List<?>)inputElement).toArray();
+ // }
+ // return new Object[0];
+ // }
+ // });
+ // referencesViewer.setLabelProvider(((IBoundedValuesController)getController()).getEditorLabelProvider());
+ //
+ // referencesViewer.getControl().setToolTipText(getTooltipText());
+ //
+ // return composite;
+ // }
+
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected Control createLabel(Composite parent) {
+ // GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ // return createLabel(parent, data);
+ // }
+ //
+ // /**
+ // * Returns the number of column for the composite
+ // *
+ // * @return the number of column for the composite
+ // */
+ // protected int getColumnNumber() {
+ // if(getIsReadOnly()) {
+ // return 1;
+ // }
+ // if(getController().canMoveValues(new ArrayList<Integer>(), 0)) {
+ // return 5;
+ // }
+ // return 3;
+ // }
/**
* {@inheritDoc}
@@ -366,71 +289,79 @@ public class MultipleReferencePropertyEditor extends AbstractPropertyEditor {
* {@inheritDoc}
*/
@Override
- public void handleContentChanged() {
- // this should tells the controller that the input has to be applied to the model
- getController().updateModel();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IStatus init(IPropertyEditorDescriptor descriptor) {
- setDescriptor(descriptor);
- setTooltipText(descriptor.getTooltipText());
- return Status.OK_STATUS;
+ protected EditingSupport createEditingSupport() {
+ return null;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getValue() {
- if(isValid(referenceArea)) {
- return currentValue;
- } else {
- Activator.log.error("trying to read the value of the reference area whereas the combo is disposed", null);
- }
- return Collections.emptyList();
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public void setValue(Object valueToEdit) {
- if(!isValid(referenceArea)) {
- return;
- }
- if(valueToEdit instanceof EList<?>) {
- currentValue = (EList<EObject>)valueToEdit;
- } else {
- Activator.log.error("Waiting for a list of EObject", null);
- }
- referencesViewer.setInput((valueToEdit != null) ? valueToEdit : Collections.emptyList());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- if(isValid(composite)) {
- composite.dispose();
- composite = null;
- setController(null);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isDisposed() {
- if(composite == null) {
- return true;
- }
- return composite.isDisposed();
- }
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public void handleContentChanged() {
+ // // this should tells the controller that the input has to be applied to the model
+ // getController().updateModel();
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public IStatus init(IPropertyEditorDescriptor descriptor) {
+ // setDescriptor(descriptor);
+ // setTooltipText(descriptor.getTooltipText());
+ // return Status.OK_STATUS;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public List<EObject> getValue() {
+ // if(isValid(referenceArea)) {
+ // return currentValue;
+ // } else {
+ // Activator.log.error("trying to read the value of the reference area whereas the combo is disposed", null);
+ // }
+ // return Collections.emptyList();
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @SuppressWarnings("unchecked")
+ // @Override
+ // public void setValue(Object valueToEdit) {
+ // if(!isValid(referenceArea)) {
+ // return;
+ // }
+ // if(valueToEdit instanceof EList<?>) {
+ // currentValue = (EList<EObject>)valueToEdit;
+ // } else {
+ // Activator.log.error("Waiting for a list of EObject", null);
+ // }
+ // referencesViewer.setInput((valueToEdit != null) ? valueToEdit : Collections.emptyList());
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public void dispose() {
+ // if(isValid(composite)) {
+ // composite.dispose();
+ // composite = null;
+ // setController(null);
+ // }
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public boolean isDisposed() {
+ // if(composite == null) {
+ // return true;
+ // }
+ // return composite.isDisposed();
+ // }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleStructuralFeaturesPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleStructuralFeaturesPropertyEditor.java
index 94dce8fe954..fce45148016 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleStructuralFeaturesPropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/MultipleStructuralFeaturesPropertyEditor.java
@@ -11,432 +11,24 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.runtime.propertyeditor;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.properties.runtime.Activator;
-import org.eclipse.papyrus.properties.runtime.controller.IBoundedValuesController;
-import org.eclipse.papyrus.properties.runtime.controller.ILabelProviderController;
-import org.eclipse.papyrus.properties.runtime.controller.IWizardPropertyEditorController;
-import org.eclipse.papyrus.properties.runtime.controller.PropertyEditorController;
-import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Table;
/**
* Property editor for structural features that have multiplicity [n..*]
*/
-public class MultipleStructuralFeaturesPropertyEditor extends AbstractPropertyEditor {
+public class MultipleStructuralFeaturesPropertyEditor extends AbstractTablePropertyEditor {
/** id of this editor */
public static final String ID = "org.eclipse.papyrus.properties.runtime.multipleStructuralFeaturesPropertyEditor";
- /** main composite created by this property editor */
- protected Composite composite;
-
- /** button to add a reference or modify existing one */
- protected Button addButton;
-
- /** button to remove reference */
- protected Button removeButton;
-
- /** table area that displays the reference name or toString */
- protected Table referenceArea;
-
- /** table area that displays the reference name or toString */
- protected TableViewer referencesViewer;
-
- /** current Value */
- protected List<Object> currentValue;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Composite createContent(Composite parent) {
- composite = getWidgetFactory().createComposite(parent, SWT.NONE);
- int columnNu = getColumnNumber();
- GridLayout layout = new GridLayout(columnNu, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- composite.setLayoutData(data);
-
- // creates label. No TOP/DOWN/etc. position, always on top
- createLabel(composite);
-
- if(!getIsReadOnly()) {
- // create Button area
- addButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- addButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Add_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- addButton.setLayoutData(data);
- addButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- public void mouseUp(MouseEvent e) {
- // 2 possibilities:
- // we can create only one type of element, so the element is created, and then, a pop up dialog is displayed
- // several elements can be created (ex: nestedClassifiers for a class, we can create a class or an interface or any implementation of classifier
- if(getController() instanceof IWizardPropertyEditorController) {
- List<IUndoableOperation> availableCommands = ((IWizardPropertyEditorController)getController()).getAvailableCreationOperations();
- if(availableCommands.isEmpty()) {
- Activator.log.warn("no command was available to create elements for this view");
- return;
- } else if(availableCommands.size() == 1) {
- // only one command is available, create the element
- try {
- OperationHistoryFactory.getOperationHistory().execute(availableCommands.get(0), new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
- } else if(availableCommands.size() > 1) {
- Menu menu = new Menu(addButton);
- for(final IUndoableOperation operation : availableCommands) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(operation.getLabel());
- item.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
- }
- menu.setVisible(true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- removeButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- removeButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Delete_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- removeButton.setLayoutData(data);
- removeButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- if(!(getController() instanceof IWizardPropertyEditorController)) {
- return;
- }
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
- List<Object> selectedObjects = selection.toList();
- IUndoableOperation deleteOperation = ((IWizardPropertyEditorController)getController()).getDeleteOperation(selectedObjects);
- if(deleteOperation != null && deleteOperation.canExecute()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(deleteOperation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
-
- }
- });
-
- if(((IBoundedValuesController)getController()).canMoveValues()) {
- Button upButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- upButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Up_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- upButton.setLayoutData(data);
- upButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
- List<Object> selectedObjects = selection.toList();
- IUndoableOperation moveOperation = ((IBoundedValuesController)getController()).getMoveCurrentValuesOperation(selectedObjects, -1);
- if(moveOperation != null && moveOperation.canExecute()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- } finally {
- // try to restore selection in the view
- referencesViewer.setSelection(selection, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
- }
-
- if(((IBoundedValuesController)getController()).canMoveValues()) {
- Button downButton = getWidgetFactory().createButton(composite, "", SWT.NONE);
- downButton.setImage(Activator.getImageFromDescriptor(Activator.imageDescriptorFromPlugin(Activator.ID, "icons/Down_12x12.gif")));
- data = new GridData(SWT.FILL, SWT.CENTER, false, false);
- downButton.setLayoutData(data);
- downButton.addMouseListener(new MouseListener() {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- // use selection to remove element
- // retrieve selected element(s)
- IStructuredSelection selection = (IStructuredSelection)referencesViewer.getSelection();
- if(selection == null || selection.isEmpty()) {
- // nothing selected.
- return;
- }
- List<Object> selectedObjects = selection.toList();
- IUndoableOperation moveOperation = ((IBoundedValuesController)getController()).getMoveCurrentValuesOperation(selectedObjects, +1);
- if(moveOperation != null && moveOperation.canExecute()) {
- try {
- OperationHistoryFactory.getOperationHistory().execute(moveOperation, new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- Activator.log.error(e1);
- } finally {
- // try to restore selection in the view
- referencesViewer.setSelection(selection, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
- }
- }
-
-
- // creates table for the display of references
- referenceArea = new Table(composite, SWT.BORDER | SWT.MULTI);
- data = new GridData(SWT.FILL, SWT.FILL, true, true, columnNu, 1);
- data.heightHint = 80;
- referenceArea.setLayoutData(data);
- referencesViewer = new TableViewer(referenceArea);
- referencesViewer.setContentProvider(new IStructuredContentProvider() {
-
- /**
- * {@inheritDoc}
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof List<?>) {
- return ((List<?>)inputElement).toArray();
- }
- return new Object[0];
- }
- });
- referencesViewer.setLabelProvider(((ILabelProviderController)getController()).getEditorLabelProvider());
- referencesViewer.getControl().setToolTipText(getTooltipText());
- return composite;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createLabel(Composite parent) {
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
- return createLabel(parent, data);
- }
-
- /**
- * Returns the number of column for the composite
- *
- * @return the number of column for the composite
- */
- protected int getColumnNumber() {
- if(getIsReadOnly()) {
- return 1;
- }
- if(((IBoundedValuesController)getController()).canMoveValues()) {
- return 5;
- }
- return 3;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setController(PropertyEditorController controller) {
- assert (controller instanceof IBoundedValuesController) : "Controller should be a IboundedValuesController";
- super.setController(controller);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void handleContentChanged() {
- // this should tells the controller that the input has to be applied to the model
- getController().updateModel();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IStatus init(IPropertyEditorDescriptor descriptor) {
- setDescriptor(descriptor);
- setTooltipText(descriptor.getTooltipText());
- return Status.OK_STATUS;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<Object> getValue() {
- if(isValid(referenceArea)) {
- return currentValue;
- } else {
- Activator.log.error("trying to read the value of the reference area whereas the combo is disposed", null);
- }
- return Collections.emptyList();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setValue(Object valueToEdit) {
- if(!isValid(referenceArea)) {
- return;
- }
- if(valueToEdit instanceof EList<?>) {
- currentValue = new ArrayList<Object>((EList<?>)valueToEdit);
- } else {
- Activator.log.error("Waiting for a list of EObject", null);
- }
- referencesViewer.setInput((valueToEdit != null) ? valueToEdit : Collections.emptyList());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- if(isValid(composite)) {
- composite.dispose();
- composite = null;
- setController(null);
- }
- }
-
/**
* {@inheritDoc}
*/
@Override
- public boolean isDisposed() {
- if(composite == null) {
- return true;
- }
- return composite.isDisposed();
+ protected EditingSupport createEditingSupport() {
+ return null;
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditor.java
new file mode 100644
index 00000000000..8a44e4a7c6d
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditor.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.PropertyEditorDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Property editor that displays only a single Composite, no information
+ */
+public class NullPropertyEditor extends AbstractPropertyEditor {
+
+ /** main composite created by this property editor */
+ private Composite composite;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Composite createContent(Composite parent) {
+ composite = getWidgetFactory().createComposite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ composite.setLayoutData(data);
+ return composite;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void handleContentChanged() {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IStatus init(IPropertyEditorDescriptor descriptor) {
+ this.setDescriptor((PropertyEditorDescriptor)descriptor);
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getValue() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setValue(Object valueToEdit) {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ if(isValid(composite)) {
+ composite.dispose();
+ composite = null;
+ setController(null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDisposed() {
+ if(composite == null) {
+ return true;
+ }
+ return composite.isDisposed();
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditorTypeValidator.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditorTypeValidator.java
new file mode 100644
index 00000000000..2b0de412ec0
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/NullPropertyEditorTypeValidator.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor;
+
+
+/**
+ * Validator which is always valid
+ */
+public class NullPropertyEditorTypeValidator implements IPropertyEditorTypeValidator {
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isValidForValue(Object valueToEdit) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setPropertyEditor(AbstractPropertyEditor editor) {
+ // nothing here
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/PropertyEditorService.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/PropertyEditorService.java
index 2801f0f808c..4dbb56bc5a4 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/PropertyEditorService.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/PropertyEditorService.java
@@ -20,6 +20,7 @@ import org.eclipse.gmf.runtime.common.ui.services.util.ActivityFilterProviderDes
import org.eclipse.papyrus.properties.runtime.Activator;
import org.eclipse.papyrus.properties.runtime.controller.PropertyEditorController;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.w3c.dom.Node;
@@ -63,11 +64,14 @@ public class PropertyEditorService extends Service {
* the controller that manages this editors
* @param id
* the identifier of the editor to create
+ * @param widgetFactory
+ * widget factory used to create the content of the editor
* @return the created property editor
*/
- public AbstractPropertyEditor createPropertyEditor(PropertyEditorController controller, String id) {
+ public AbstractPropertyEditor createPropertyEditor(PropertyEditorController controller, String id, TabbedPropertySheetWidgetFactory widgetFactory) {
Object result = executeUnique(ExecutionStrategy.REVERSE, new CreatePropertyEditorOperation(controller, id));
if(result instanceof AbstractPropertyEditor) {
+ ((AbstractPropertyEditor)result).setWidgetFactory(widgetFactory);
return (AbstractPropertyEditor)result;
}
Activator.log.error("impossible to create the editor using id " + id, null);
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/RadioBoxPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/RadioBoxPropertyEditor.java
index 3f2cecb547c..df663a61b6e 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/RadioBoxPropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/RadioBoxPropertyEditor.java
@@ -75,7 +75,12 @@ public class RadioBoxPropertyEditor extends AbstractPropertyEditor {
// create the set of radio-boxes. Does not know the size of the grid used for this editor
for(String value : values) {
Button button = getWidgetFactory().createButton(composite, (!value.equals("") ? value : "<Unset>"), SWT.RADIO);
- button.addSelectionListener(listener);
+ if(!getIsReadOnly()) {
+ button.setEnabled(true);
+ button.addSelectionListener(listener);
+ } else {
+ button.setEnabled(false);
+ }
buttons.add(button);
button.setToolTipText(getTooltipText());
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptor.java
new file mode 100644
index 00000000000..a38f7d86ad8
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptor.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Descriptor specific to the multi-valued primitive typed property editor
+ */
+public class MultiplePrimitiveTypedPropertyEditorDescriptor extends PropertyEditorDescriptor {
+
+ /**
+ * Creates a new MultiplePrimitiveTypedPropertyEditorDescriptor.
+ *
+ * @param editorId
+ * the unique identifier for this editor factory
+ * @param label
+ * the label for this property editor
+ * @param tooltipText
+ * the tooltip text for this property editor
+ */
+ public MultiplePrimitiveTypedPropertyEditorDescriptor(String editorId, String label, String tooltipText) {
+ super(editorId, label, tooltipText);
+ }
+
+ /**
+ * Creates a new MultiplePrimitiveTypedPropertyEditorDescriptor.
+ *
+ * @param editorId
+ * the unique identifier for this editor factory
+ * @param label
+ * the label for this property editor
+ * @param labelPosition
+ * the label position for this property editor
+ * @param tooltipText
+ * the tooltip text for this property editor
+ * @param imageDescriptor
+ * the icon for this property editor
+ */
+ public MultiplePrimitiveTypedPropertyEditorDescriptor(String editorId, String label, int labelPosition, String tooltipText, ImageDescriptor imageDescriptor) {
+ super(editorId, label, labelPosition, tooltipText, imageDescriptor);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptorFactory.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptorFactory.java
new file mode 100644
index 00000000000..24359f46add
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/propertyeditor/descriptor/MultiplePrimitiveTypedPropertyEditorDescriptorFactory.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.properties.runtime.Activator;
+import org.eclipse.swt.SWT;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Factory for multiple primitive typed property editor descriptors
+ */
+public class MultiplePrimitiveTypedPropertyEditorDescriptorFactory implements IPropertyEditorDescriptorFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public IPropertyEditorDescriptor createEditorDescriptor(Node editorNode) {
+ String identifier = "";
+ String label = "";
+ String tooltipText = "";
+ int labelPosition = SWT.LEFT;
+ ImageDescriptor imageDescriptor = null;
+
+ // retrieve id, label, label position and tooltipText
+ NamedNodeMap attributes = editorNode.getAttributes();
+ if(attributes != null) {
+ for(int i = 0; i < attributes.getLength(); i++) {
+ Node attribute = attributes.item(i);
+ String nodeName = attribute.getNodeName();
+ if("label".equals(nodeName)) {
+ label = attribute.getNodeValue();
+ } else if("labelPosition".equals(nodeName)) {
+ labelPosition = Integer.parseInt(attribute.getNodeValue());
+ } else if("id".equals(nodeName)) {
+ identifier = attribute.getNodeValue();
+ } else if("tooltip".equals(nodeName)) {
+ tooltipText = attribute.getNodeValue();
+ }
+ }
+ }
+
+ // retrieve icon
+ NodeList children = editorNode.getChildNodes();
+ for(int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if("icon".equals(child.getNodeName())) {
+ NamedNodeMap iconAttributes = child.getAttributes();
+ if(iconAttributes != null) {
+ // retrieve plugin id and path
+ Node pluginIDNode = iconAttributes.getNamedItem("pluginID");
+ Node pathNode = iconAttributes.getNamedItem("path");
+ if(pluginIDNode != null && pathNode != null) {
+ imageDescriptor = Activator.imageDescriptorFromPlugin(pluginIDNode.getNodeValue(), pathNode.getNodeValue());
+ }
+ }
+ }
+ }
+
+ return new MultiplePrimitiveTypedPropertyEditorDescriptor(identifier, label, labelPosition, tooltipText, imageDescriptor);
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/PropertyViewService.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/PropertyViewService.java
index d586879dd10..fab2ca6d256 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/PropertyViewService.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/PropertyViewService.java
@@ -33,6 +33,7 @@ import org.eclipse.papyrus.properties.runtime.controller.descriptor.IPropertyEdi
import org.eclipse.papyrus.properties.runtime.dialogs.GetDialogDescriptorOperation;
import org.eclipse.papyrus.properties.runtime.dialogs.GetDialogDescriptorOperationById;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
* Service to provide property views providers.
@@ -88,13 +89,14 @@ public class PropertyViewService extends Service implements IPreferenceChangeLis
* the composite parent for the property view
* @param controllerDescriptor
* the descriptor of the property editor controller
+ * @param widgetFactory
* @return the created controller for the property editor
*/
- public PropertyEditorController createPropertyEditorController(List<Object> objectsToEdit, Composite parent, IPropertyEditorControllerDescriptor controllerDescriptor) {
+ public PropertyEditorController createPropertyEditorController(List<Object> objectsToEdit, Composite parent, IPropertyEditorControllerDescriptor controllerDescriptor, TabbedPropertySheetWidgetFactory widgetFactory) {
PropertyEditorController controller = PropertyEditorControllerService.getInstance().createPropertyEditorController(objectsToEdit, parent, controllerDescriptor);
if(controller != null) {
- controller.createPropertyEditor(controllerDescriptor.getEditorDescriptor());
+ controller.createPropertyEditor(controllerDescriptor.getEditorDescriptor(), widgetFactory);
}
return controller;
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ContainerDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ContainerDescriptor.java
index 96ccb95fae4..0bb89a54c27 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ContainerDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ContainerDescriptor.java
@@ -111,7 +111,7 @@ public class ContainerDescriptor extends AbstractContainerDescriptor {
getDescribedComposite().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
- controllers = updateControllers();
+ controllers = updateControllers(widgetFactory);
return controllers;
}
@@ -127,9 +127,12 @@ public class ContainerDescriptor extends AbstractContainerDescriptor {
/**
* Update controllers managed by this descriptor
*
+ * @param widgetFactory
+ * widget factory used to create content of the editors
+ *
* @return the list of update controllers
*/
- protected List<PropertyEditorController> updateControllers() {
+ protected List<PropertyEditorController> updateControllers(TabbedPropertySheetWidgetFactory widgetFactory) {
// clear and re-create the list of controllers
for(PropertyEditorController controller : controllers) {
controller.dispose();
@@ -145,7 +148,7 @@ public class ContainerDescriptor extends AbstractContainerDescriptor {
if(!parseFailed) {
// creates the content for the controllers
for(IPropertyEditorControllerDescriptor descriptor : getControllerDescriptors()) {
- controllers.add(PropertyViewService.getInstance().createPropertyEditorController(objectsToEdit, getPropertyEditorContainer(), descriptor));
+ controllers.add(PropertyViewService.getInstance().createPropertyEditorController(objectsToEdit, getPropertyEditorContainer(), descriptor, widgetFactory));
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ExpandableContainerDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ExpandableContainerDescriptor.java
index 36cf61ee91b..8d05553e402 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ExpandableContainerDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/ExpandableContainerDescriptor.java
@@ -98,7 +98,7 @@ public class ExpandableContainerDescriptor extends ContainerDescriptor {
getDescribedComposite().setClient(expandableContainer);
}
- controllers = updateControllers();
+ controllers = updateControllers(widgetFactory);
return controllers;
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/GroupContainerDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/GroupContainerDescriptor.java
index 047263fb20e..8ed50ae3793 100644
--- a/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/GroupContainerDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.runtime/src/org/eclipse/papyrus/properties/runtime/view/content/GroupContainerDescriptor.java
@@ -89,7 +89,7 @@ public class GroupContainerDescriptor extends ContainerDescriptor {
getDescribedComposite().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
- controllers = updateControllers();
+ controllers = updateControllers(widgetFactory);
return controllers;
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/META-INF/MANIFEST.MF
index bea28166780..e50342a86a8 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.properties.tabbed.core;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.properties.tabbed.core.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/about.html b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/build.properties b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/build.properties
index dba118d444d..abdf037aea1 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/build.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/build.properties
@@ -4,4 +4,8 @@ bin.includes = META-INF/,\
.,\
bin/,\
plugin.properties,\
- icons/
+ icons/,\
+ about.html
+src.includes = about.html,\
+ icons/,\
+ plugin.properties
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/plugin.properties b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/plugin.properties
index dafa622ff27..a15d01869ae 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/plugin.properties
@@ -9,4 +9,4 @@
# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - initial API and implementation
##################################################################################
pluginName=Papyrus Tabbed Properties Core (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/DynamicSection.java b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/DynamicSection.java
index 94348e0cb6b..1ca239f74e9 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/DynamicSection.java
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/DynamicSection.java
@@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.properties.runtime.view.IFragmentDescriptor;
import org.eclipse.papyrus.properties.runtime.view.content.AbstractContainerDescriptor;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
@@ -81,10 +82,17 @@ public class DynamicSection extends AbstractPropertySection {
*/
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
+ // force new layout to grid layout, not fill layout
+ parent.setLayout(new GridLayout(1, true));
this.tabbedPropertySheetPage = tabbedPropertySheetPage;
// creates a composite that has a grid layout
this.parent = tabbedPropertySheetPage.getWidgetFactory().createComposite(parent);
- this.parent.setLayout(new GridLayout(1, false));
+ GridData data = new GridData(GridData.FILL_BOTH);
+ this.parent.setLayoutData(data);
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ this.parent.setLayout(layout);
}
/**
@@ -123,7 +131,7 @@ public class DynamicSection extends AbstractPropertySection {
refreshDisplay(newObjects);
// force the parent to layout
- parent.layout(true, true);
+ parent.layout(false, true);
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/PropertyTabViewProviderParser.java b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/PropertyTabViewProviderParser.java
index c2b3033285f..65600d590fe 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/PropertyTabViewProviderParser.java
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.core/src/org/eclipse/papyrus/properties/tabbed/core/view/PropertyTabViewProviderParser.java
@@ -310,7 +310,9 @@ public class PropertyTabViewProviderParser extends PropertyViewProviderParser {
replacedSectionsId = parseReplacedSectionIds(childNode);
} else if(NODE_NAME_FRAGMENT.equals(childNode.getNodeName())) {
IFragmentDescriptor fragmentDescriptor = parseFragmentOrPredefinedFragment(childNode);
- fragmentDescriptors.add(fragmentDescriptor);
+ if(fragmentDescriptor != null) {
+ fragmentDescriptors.add(fragmentDescriptor);
+ }
}
}
} catch (XMLParseException e) {
@@ -438,7 +440,9 @@ public class PropertyTabViewProviderParser extends PropertyViewProviderParser {
FragmentDescriptor fragmentDescriptor;
try {
fragmentDescriptor = parseFragment(fragmentNode);
- predefinedFragments.put(fragmentDescriptor.getId(), fragmentDescriptor);
+ if(fragmentDescriptor != null) {
+ predefinedFragments.put(fragmentDescriptor.getId(), fragmentDescriptor);
+ }
return fragmentDescriptor;
} catch (XMLParseException e) {
Activator.log.error(e);
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/META-INF/MANIFEST.MF
index 9ec94fce687..496815f2674 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.properties.tabbed.customization;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.properties.tabbed.customization.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/about.html b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/build.properties b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/build.properties
index dd01f8ee265..01bf44ff0af 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/build.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/build.properties
@@ -5,4 +5,5 @@ bin.includes = META-INF/,\
icons/,\
plugin.properties,\
plugin.xml,\
- resources/
+ resources/,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/plugin.properties b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/plugin.properties
index 89d95b5e669..c58a5855214 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/plugin.properties
@@ -9,4 +9,4 @@
# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - initial API and implementation
##################################################################################
pluginName=Papyrus Tabbed Properties Customization Tool (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/ReferenceStateBeanPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/ReferenceStateBeanPropertyEditorController.java
index 8e028931308..83cb41632ac 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/ReferenceStateBeanPropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/ReferenceStateBeanPropertyEditorController.java
@@ -5,7 +5,6 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -282,18 +281,5 @@ public class ReferenceStateBeanPropertyEditorController extends StateBeanPropert
return labelProvider;
}
- /**
- * {@inheritDoc}
- */
- public IUndoableOperation getMoveCurrentValuesOperation(List<Object> objects, int move) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canMoveValues() {
- return false;
- }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/StateBeanPropertyEditorController.java b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/StateBeanPropertyEditorController.java
index 150d323052b..0973a5264c4 100644
--- a/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/StateBeanPropertyEditorController.java
+++ b/plugins/core/org.eclipse.papyrus.properties.tabbed.customization/src/org/eclipse/papyrus/properties/tabbed/customization/state/StateBeanPropertyEditorController.java
@@ -16,9 +16,11 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
+import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.papyrus.properties.runtime.controller.BeanPropertyEditorController;
import org.eclipse.papyrus.properties.runtime.state.IState;
import org.eclipse.papyrus.properties.tabbed.customization.Activator;
+import org.eclipse.swt.widgets.Composite;
/**
@@ -162,4 +164,45 @@ public class StateBeanPropertyEditorController extends BeanPropertyEditorControl
refreshDisplay();
}
}
+
+ public IUndoableOperation getMoveCurrentValuesOperation(List<Integer> indexes, int move) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean canMoveValues(List<Integer> indexes, int move) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public List<IUndoableOperation> getCreateValueOperations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean canCreateValueOperations() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public IUndoableOperation getDeleteValueOperation(List<Integer> indexes) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean canDeleteValueOperation() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public IUndoableOperation getEditValueOperation(int index, Composite parent, Object value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean canCreateEditOperation(int index, Composite parent, Object value) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor.di/.classpath b/plugins/core/org.eclipse.papyrus.sasheditor.di/.classpath
index 2f23567a779..5d7885f51c5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor.di/.classpath
+++ b/plugins/core/org.eclipse.papyrus.sasheditor.di/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="custom-src"/>
- <classpathentry kind="src" path="test"/>
+ <!-- <classpathentry kind="src" path="test"/>-->
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor.di/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.sasheditor.di/META-INF/MANIFEST.MF
index e0ab18f98d8..658b7f374a5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor.di/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.sasheditor.di/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.sasheditor.di;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -18,7 +18,6 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.5.0";visibility:=reexport,
org.eclipse.papyrus.sasheditor;bundle-version="0.7.0";visibility:=reexport,
org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
- org.junit;bundle-version="3.8.2",
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
org.eclipse.emf.transaction;bundle-version="1.4.0"
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor.di/plugin.properties b/plugins/core/org.eclipse.papyrus.sasheditor.di/plugin.properties
index 4fe8da1dc94..eb80a57c1a7 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor.di/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.sasheditor.di/plugin.properties
@@ -4,5 +4,5 @@
#
# $Id$
-pluginName = Sashwindowsdi Model
-providerName = www.example.org
+pluginName = Papyrus Sashwindows di Model (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/.classpath b/plugins/core/org.eclipse.papyrus.sasheditor/.classpath
index b9209caf3b5..2d1a4302f04 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/.classpath
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/.classpath
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src2"/>
- <classpathentry kind="src" path="test"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.sasheditor/META-INF/MANIFEST.MF
index 3044f2af683..7c2876fd4ff 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/META-INF/MANIFEST.MF
@@ -2,11 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.sasheditor;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Export-Package: org.eclipse.papyrus.sasheditor.contentprovider,
+Export-Package: org.eclipse.papyrus.sasheditor,
+ org.eclipse.papyrus.sasheditor.contentprovider,
org.eclipse.papyrus.sasheditor.contentprovider.simple,
org.eclipse.papyrus.sasheditor.editor,
org.eclipse.papyrus.sasheditor.editor.actionbarcontributor,
@@ -16,7 +17,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.papyrus.sasheditor.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.gef,
- org.junit,
+ org.junit;bundle-version="4.8.1";resolution:=optional,
org.eclipse.papyrus.log;visibility:=reexport,
org.eclipse.emf.transaction;bundle-version="1.4.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/build.properties b/plugins/core/org.eclipse.papyrus.sasheditor/build.properties
index 8865565d3a1..51416e4bb80 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/build.properties
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/build.properties
@@ -2,7 +2,7 @@
jars.compile.order = .
output.. = bin/
-source.. = src2/
+source.. = src/
bin.includes = .,\
META-INF/,\
@@ -12,10 +12,6 @@ bin.includes = .,\
plugin.xml
src.includes = about.html,\
- src2/,\
- plugin.xml,\
- META-INF/,\
- plugin.properties,\
build.properties,\
schema/
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/plugin.properties b/plugins/core/org.eclipse.papyrus.sasheditor/plugin.properties
index ffc182dcac9..f866c4077df 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/plugin.properties
@@ -9,7 +9,7 @@
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
##################################################################################
pluginName=Papyrus SashEditor (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/Activator.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/Activator.java
index d6951e52275..aef149ed967 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/Activator.java
@@ -29,7 +29,7 @@ public class Activator extends AbstractUIPlugin {
private static Activator plugin;
/** Logging helper */
- public static LogHelper log = new LogHelper();
+ public static LogHelper log;
/**
* The constructor
@@ -45,8 +45,7 @@ public class Activator extends AbstractUIPlugin {
super.start(context);
plugin = this;
// register the login helper
-// log = new LogHelper(plugin);
- log.setPlugin(plugin);
+ log = new LogHelper(plugin);
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java
index d12895033ed..d12895033ed 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IAbstractPanelModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java
index 6078b7d2228..6078b7d2228 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IComponentModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java
index 5628848fd40..5628848fd40 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedListener.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java
index d13f3ab8ee6..d13f3ab8ee6 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IContentChangedProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java
index e4274525d7c..e4274525d7c 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IEditorModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java
index 6422a9b98e5..6422a9b98e5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngr.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java
index 7d2a1e5cf4b..7d2a1e5cf4b 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/IPageModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java
index 9ac740aae14..9ac740aae14 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashPanelModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java
index 21547c65966..21547c65966 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ISashWindowsContentProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java
index a19b7485c46..a19b7485c46 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/ITabFolderModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java
index b76fd527cc0..b76fd527cc0 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java
index 02453aa5f20..02453aa5f20 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/AbstractPanelModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java
index 37b173a81da..37b173a81da 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/RootModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java
index 4cbbb35c93d..4cbbb35c93d 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SashPanelModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
index 7bc6c377673..7bc6c377673 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java
index 4d74a6cd65d..4d74a6cd65d 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/simple/TabFolderModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
index a318a507fe9..a318a507fe9 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
index b4d133f10dd..b4d133f10dd 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java
index 2d15d9338d5..2d15d9338d5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/AbstractMultiPageSashEditor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java
index 18784ffb6cb..18784ffb6cb 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IComponentPage.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java
index a6e42ec74ff..a6e42ec74ff 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IEditorPage.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java
index 467f0735d49..467f0735d49 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IMultiPageEditorPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPage.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPage.java
index 39922e802df..39922e802df 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPage.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPage.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java
index 4707a6c0d9d..4707a6c0d9d 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageChangedListener.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java
index dad06cd01a0..dad06cd01a0 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/IPageVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java
index 295ab654196..295ab654196 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainer.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java
index d494aaf4277..d494aaf4277 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/ISashWindowsContainerChangedListener.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java
index 5a688cdc488..5a688cdc488 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashTabDecorationSynchronizer.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java
index ae60cf0dd54..ae60cf0dd54 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/SashWindowsEventsProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
index 95cf4c23c13..95cf4c23c13 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
index 895ce3f7549..895ce3f7549 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
index dfc3b290f41..dfc3b290f41 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java
index 3c2ec027fd5..3c2ec027fd5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/editor/gef/MultiDiagramEditorGefDelegate.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java
index 19d3ab0d88d..19d3ab0d88d 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPanelPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java
index 00ee3724e5f..00ee3724e5f 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/AbstractPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java
index 7156949f3e4..7156949f3e4 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActiveEditorServicesSwitcher.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java
index a0beaedfb1d..a0beaedfb1d 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ActivePageTracker.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java
index 34840ca25f5..34840ca25f5 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ComponentPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/Copyright.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/Copyright.java
index 6b7685c1820..6b7685c1820 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/Copyright.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/Copyright.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/EditorPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/EditorPart.java
index f64503fa19a..f64503fa19a 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/EditorPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/EditorPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java
index 9f07d244b32..9f07d244b32 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IMultiEditorManager.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java
index accadf0e16f..accadf0e16f 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPanelParent.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java
index e9e8dfdd2a9..e9e8dfdd2a9 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/IPartVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java
index 15a0dc36c2a..15a0dc36c2a 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ImageToolTipManager.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java
index 5b583190419..5b583190419 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupFolderPartByRawModelVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java
index 3a34b107215..3a34b107215 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupIPageByIEditorPartVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java
index b4079d09eb6..b4079d09eb6 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/LookupModelPageVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java
index bc9d33a711f..bc9d33a711f 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/NotFoundException.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java
index ef03d2729ad..ef03d2729ad 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PTabFolder.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PagePart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PagePart.java
index 25086298ac2..25086298ac2 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PagePart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PagePart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java
index dd9ca4c8ba8..dd9ca4c8ba8 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PageVisitorWrapper.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartLists.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartLists.java
index d93ae6d2494..d93ae6d2494 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartLists.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartLists.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java
index 9ca6cdb9205..9ca6cdb9205 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/PartVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java
index 2318f0920c4..2318f0920c4 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ReplaceableSashForm.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/RootPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/RootPart.java
index e495147a7d1..e495147a7d1 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/RootPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/RootPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java
index a934e0a27d7..a934e0a27d7 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsListener.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java
index 9f0878384a7..9f0878384a7 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java
index 7e5795c6d6b..7e5795c6d6b 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashPanelPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java
index 57da13f283f..57da13f283f 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainer.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java
index d5631d5008a..d5631d5008a 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/SashWindowsException.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java
index 541cd0dad9e..541cd0dad9e 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/ShowPartStatusVisitor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java
index f77f7069599..f77f7069599 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabFolderPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java
index eb5cfec36c9..eb5cfec36c9 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/TabItemPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
index aace9b4280e..aace9b4280e 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
index 4127f903a5c..4127f903a5c 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
index e8cae5303d2..e8cae5303d2 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java
index 5d3a57cc111..5d3a57cc111 100644
--- a/plugins/core/org.eclipse.papyrus.sasheditor/src2/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java
+++ b/plugins/core/org.eclipse.papyrus.sasheditor/src/org/eclipse/papyrus/sasheditor/multipage/editor/MultiPageEditor.java
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngrTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngrTest.java
deleted file mode 100644
index 93c42cc28c6..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/IPageMngrTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.contentprovider;
-
-import junit.framework.TestCase;
-
-
-/**
- * Base class for testing real implementation of ContentProvider.
- * Real implementation should subclass this class, and implement the create method.
- *
- * @author cedric dumoulin
- *
- */
-public abstract class IPageMngrTest extends TestCase {
-
- /**
- * The public API allowing to access to the implementation.
- */
- protected ISashWindowsContentProvider contentProvider;
-
- /**
- * The public API allowing to access to the implementation.
- */
-// protected IPageMngr pageMngr;
-
- /**
- * Setup the test.
- * @see junit.framework.TestCase#setUp()
- *
- * @throws Exception
- */
- @Override
- protected void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- // TODO Auto-generated method stub
- super.tearDown();
- }
-
- /**
- * Test that the pageIdentifier passed to addPAge() is provided back from
- * {@link ISashWindowsContainer#getActiveEditor()()}
- */
- public void testAddPage() {
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/FakePageModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/FakePageModel.java
deleted file mode 100644
index 43bdf5ed67c..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/FakePageModel.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sasheditor.contentprovider.simple;
-
-import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * A fake page for testing purpose
- *
- * @author dumoulin
- */
-public class FakePageModel implements IPageModel {
-
- String title;
-
- static int count = 0;
-
- public FakePageModel() {
- title = "noname" + count++;
- }
-
- /**
- * @param title
- */
- public FakePageModel(String title) {
- this.title = title;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getRawModel() {
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Image getTabIcon() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getTabTitle() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProviderTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProviderTest.java
deleted file mode 100644
index 0d90ba92044..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/contentprovider/simple/SimpleSashWindowsContentProviderTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sasheditor.contentprovider.simple;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel;
-import org.eclipse.swt.SWT;
-
-
-/**
- * @author dumoulin
- */
-public class SimpleSashWindowsContentProviderTest extends TestCase {
-
- protected SimpleSashWindowsContentProvider contentProvider;
-
- /**
- * Initialize the tree {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- createContentProvider();
- }
-
- /**
- * Create a tree
- */
- private void createContentProvider() {
- contentProvider = new SimpleSashWindowsContentProvider();
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#addPage(org.eclipse.papyrus.sasheditor.contentprovider.IPageModel)}
- * .
- */
- public void testAddTabIPageModel() {
- IPageModel newModel = new FakePageModel();
- contentProvider.addPage(newModel);
-
- assertTrue("Folder contains added item", contentProvider.getCurrentTabFolder().getChildren().contains(newModel));
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#movePage(org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int, int)}
- * .
- */
- // public void testMoveTabITabFolderModelIntInt() {
- // fail("Not yet implemented");
- // }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#movePage(org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int, org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int)}
- * .
- */
- // public void testMoveTabITabFolderModelIntITabFolderModelInt() {
- // fail("Not yet implemented");
- // }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#createFolder(org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int, org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int)}
- * .
- */
- public void testCreateFolder() {
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 8; i++) {
- IPageModel newModel = new FakePageModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- ITabFolderModel folder = contentProvider.getCurrentTabFolder();
-
- // // Do move tab 0 to right
- // ITabFolderModel newFolder = contentProvider.createFolder(folder, 0, folder, SWT.RIGHT);
- // // Check creation
- // assertNotNull("Folder created", newFolder);
- // // Check if correctly attached and reachable
- // assertEquals("Tab 2 added in correct folder", folder, contentProvider.getParentFolder(newModel2));
- // assertEquals("Tab 1 added in correct folder", newFolder, contentProvider.getParentFolder(newModel1));
- //
- //// assertNotNull("folder attached", contentProvider.getParentFolder(newModel1));
- //// assertNotNull("folder attached", contentProvider.getParentFolder(newModel1));
- //
- // assertTrue("Folder contains added item", newFolder.getChildren().contains(newModel1));
- // assertTrue("Folder contains added item", folder.getChildren().contains(newModel2));
-
-
- //
- // Create another folder
- int index = 0;
- IPageModel movedTab = models.get(index++);
- assertEquals("moved tab is the first in tab", movedTab, folder.getChildren().get(0));
- contentProvider.createFolder(folder, 0, folder, SWT.UP);
- // Find created folder
- ITabFolderModel newFolder2 = contentProvider.getParentFolder(movedTab);
- assertFolderCreated(folder, newFolder2, movedTab);
-
- movedTab = models.get(index++);
- assertEquals("moved tab is the first in tab", movedTab, folder.getChildren().get(0));
- contentProvider.createFolder(folder, 0, newFolder2, SWT.UP);
- ITabFolderModel newFolder3 = contentProvider.getParentFolder(movedTab);
- assertFolderCreated(folder, newFolder3, movedTab);
-
- movedTab = models.get(index++);
- assertEquals("moved tab is the first in tab", movedTab, folder.getChildren().get(0));
- contentProvider.createFolder(folder, 0, newFolder2, SWT.DOWN);
- ITabFolderModel newFolder4 = contentProvider.getParentFolder(movedTab);
- assertFolderCreated(folder, newFolder4, movedTab);
-
- movedTab = models.get(index++);
- assertEquals("moved tab is the first in tab", movedTab, folder.getChildren().get(0));
- contentProvider.createFolder(folder, 0, folder, SWT.LEFT);
- ITabFolderModel newFolder5 = contentProvider.getParentFolder(movedTab);
- assertFolderCreated(folder, newFolder5, movedTab);
-
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#createFolder(org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int, org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel, int)}
- * .
- */
- public void testCreateFolder_ITabFolderModel_int() {
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 8; i++) {
- IPageModel newModel = new FakePageModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- ITabFolderModel referenceFolder = contentProvider.getCurrentTabFolder();
-
- assertNotNull("referenceFolder exist", referenceFolder);
-
- // Create a new folder.
- ITabFolderModel createdFolder = contentProvider.createFolder(referenceFolder, SWT.TOP);
-
- assertNotNull("folder created", createdFolder);
-
- }
-
- /**
- * Assert folder is correctly created
- *
- * @param srcFolder
- * @param newFolder
- * @param movedTab
- */
- protected void assertFolderCreated(ITabFolderModel srcFolder, ITabFolderModel newFolder, IPageModel movedTab) {
- // Check creation
- assertNotNull("Folder exist", newFolder);
-
- // Check if it is really a new folder
- assertNotSame("Old folder and new folder are differents", srcFolder, newFolder);
-
- // Check removed from source
- assertFalse("item removed from source folder", srcFolder.getChildren().contains(movedTab));
- // Check contained in created folder
- assertTrue("Folder contains added item", newFolder.getChildren().contains(movedTab));
- }
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#removePage(int)}.
- */
- // public void testRemoveTabInt() {
- // fail("Not yet implemented");
- // }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider#removePage(org.eclipse.papyrus.sasheditor.contentprovider.IPageModel)}
- * .
- */
- // public void testRemoveTabIPageModel() {
- // fail("Not yet implemented");
- // }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/FakeEditorModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/FakeEditorModel.java
deleted file mode 100644
index 9602494f120..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/FakeEditorModel.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.editor;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.part.EditorPart;
-
-
-/**
- * A simple model that can be used as editor in tests.
- * @author cedric dumoulin
- *
- */
-public class FakeEditorModel implements IEditorModel {
-
-
- private String name;
-
- public FakeEditorModel() {
- name = "noname";
- }
- /**
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabTitle()
- *
- * @return
- */
- public String getTabTitle() {
- return name;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabIcon()
- *
- * @return
- */
- public Image getTabIcon() {
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getRawModel()
- *
- * @return
- */
- public Object getRawModel() {
- // TODO Auto-generated method stub
- return this;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- *
- * @return
- * @throws PartInitException
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- return new FakeEditorPart();
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- *
- * @return
- */
- public EditorActionBarContributor getActionBarContributor() {
- return null;
- }
-
- /**
- * A class implementing a fake editor.
- * @author dumoulin
- *
- */
- public class FakeEditorPart extends EditorPart {
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- }
-
- @Override
- public void doSaveAs() {
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- setPartName(input.getName());
- }
-
- @Override
- public boolean isDirty() {
- return false;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- // do nothing
-
- }
-
- @Override
- public void setFocus() {
- }
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/MessagePartModel.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/MessagePartModel.java
deleted file mode 100644
index eafb0e28e85..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/MessagePartModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.papyrus.sasheditor.editor;
-
-import org.eclipse.papyrus.sasheditor.contentprovider.IComponentModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Description of the first page
- *
- * @author dumoulin
- */
-
-public class MessagePartModel implements IComponentModel {
-
- private String title;
-
- private String msg;
-
- static private int count = 0;
-
-
- /**
- *
- */
- public MessagePartModel(String msg) {
- title = "newMsg " + count++;
- this.msg = msg;
- }
-
- /**
- * @param title
- */
- public MessagePartModel(String title, String msg) {
- this.title = title;
- this.msg = msg;
- }
-
- /**
- * Return the control to be shown. {@inheritDoc}
- */
- public Composite createPartControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- FillLayout layout = new FillLayout();
- composite.setLayout(layout);
- StyledText text;
-
- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
- text.setEditable(false);
-
- text.setText(" " + msg + " - " + getTabTitle());
- return composite;
- }
-
- public Image getTabIcon() {
- return null;
- }
-
- public String getTabTitle() {
- return title;
- }
-
- /**
- * Return this. In this implementation, the rawModel and the IEditorModel are the same.
- *
- */
- public Object getRawModel() {
- return this;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/SashMultiPageEditorTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/SashMultiPageEditorTest.java
deleted file mode 100644
index 61e08b69f7e..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/SashMultiPageEditorTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.editor;
-
-import junit.framework.TestCase;
-
-
-/**
- * @author dumoulin
- */
-public class SashMultiPageEditorTest extends TestCase {
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.editor.AbstractMultiPageSashEditor#refreshTabs()}.
- */
- public void testRefreshTabs() {
- // fail("Not yet implemented"); // TODO
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/ShellEditor.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/ShellEditor.java
deleted file mode 100644
index f86f5a598bc..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/editor/ShellEditor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sasheditor.editor;
-
-import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.ISashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A standalone application testing the Sash system.
- * It must be run as Java program.
- *
- * @author dumoulin
- */
-public class ShellEditor {
-
- protected SashWindowsContainer sashContainer;
-
- protected ISashWindowsContentProvider contentProvider;
-
- /**
- * Constructor.
- *
- * @param parent
- */
- public ShellEditor(Shell parent) {
- parent.setText(this.getClass().getSimpleName());
- init();
- createPartControl(parent);
-
- // add tabItem
- int count = 0;
- IPageModel tabItem = new MessagePartModel("msg" + count++);
- contentProvider.addPage(tabItem);
- tabItem = new MessagePartModel("msg" + count++);
- contentProvider.addPage(tabItem);
-
- sashContainer.refreshTabs();
- }
-
- /**
- * init th class
- */
- protected void init() {
- contentProvider = new SimpleSashWindowsContentProvider();
- sashContainer = new SashWindowsContainer();
-
- initContentProvider();
- sashContainer.setContentProvider(contentProvider);
-
- }
-
- /**
- * Create some windows.
- */
- protected void initContentProvider() {
- int count = 0;
- IPageModel tabItem = new MessagePartModel("msg" + count++);
- contentProvider.addPage(tabItem);
-
- tabItem = new MessagePartModel("msg0" + count++);
- contentProvider.addPage(tabItem);
- }
-
- /**
- * Create SWT control of this class
- *
- * @param parent
- */
- protected void createPartControl(Composite parent) {
- // Text newText = new Text(parent, SWT.BORDER & SWT.SCROLL_PAGE);
-
- sashContainer.createPartControl(parent);
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- Display display = new Display();
-
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
- new ShellEditor(shell);
-
- shell.open();
-
- while(!shell.isDisposed()) {
- if(!display.readAndDispatch())
- display.sleep();
- }
-
- display.dispose();
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakePagePart.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakePagePart.java
deleted file mode 100644
index 7f4e0708461..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakePagePart.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.internal;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * A Page part for testing purpose. This page cannot be used in the SashContainer.
- * @author cedric dumoulin
- *
- */
-public class FakePagePart extends PagePart {
-
- public FakePagePart() {
- super(null, null);
- }
-
- @Override
- boolean visit(IPartVisitor visitor) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Control getControl() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void reparent(TabFolderPart parent) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setFocus() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void garbage() {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakeSashContainerEventsListener.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakeSashContainerEventsListener.java
deleted file mode 100644
index 8569b1cc836..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/FakeSashContainerEventsListener.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.sasheditor.editor.IPage;
-
-
-/**
- * A fake listener implementation for testing purpose.
- * @author cedric dumoulin
- *
- */
-public class FakeSashContainerEventsListener implements SashContainerEventsListener {
-
- public static final String PAGE_CHANGED = "pageChanged";
-
- public static final String PAGE_OPENED = "pageOpened";
-
- public static final String PAGE_CLOSED = "pageClosed";
-
- public static final String PAGE_ACTIVATED = "pageActivated";
-
- public static final String PAGE_DEACTIVATED = "pageDeactivated";
-
- public static final String PAGE_ABOUTTOBECLOSED = "pageAboutToBeClosed";
-
- public static final String PAGE_ABOUTTOBEOPENED = "pageAboutToBeOpened";
-
- /** */
- public int eventCount = 0;
-
- /** */
- public List<String> traces;
-
- /** */
- public List<IPage> events;
-
- /**
- *
- * Constructor.
- *
- */
- public FakeSashContainerEventsListener() {
- traces = new ArrayList<String>();
- events = new ArrayList<IPage>();
- }
-
-
- /**
- * @return the eventCount
- */
- public int getEventCount() {
- return eventCount;
- }
-
-
- /**
- * @return the trace
- */
- public List<String> getTraces() {
- return traces;
- }
-
- /**
- * @return the trace
- */
- public String getTrace(int index) {
- return traces.get(index);
- }
-
- /**
- * @return the trace
- */
- public List<IPage> getEvents() {
- return events;
- }
-
- /**
- * @return the trace
- */
- public IPage getEvent(int index) {
- return events.get(index);
- }
-
- /**
- *
- */
- public void resetChangeCount() {
- eventCount = 0;
- }
-
- /**
- *
- */
- public void resetTraces() {
- traces.clear();
- events.clear();
- }
-
- /* ************************** */
- /* Methods */
- /* ************************** */
-
- /**
- * @see org.eclipse.papyrus.sasheditor.editor.IPageChangedListener#pageChanged(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param newPage
- */
- public void pageChanged(IPage newPage) {
- traces.add(PAGE_CHANGED);
- events.add(newPage);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageOpened(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageOpened(IPage page) {
- traces.add(PAGE_OPENED);
- events.add(page);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageClosed(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageClosed(IPage page) {
- traces.add(PAGE_CLOSED);
- events.add(page);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageActivated(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageActivated(IPage page) {
- traces.add(PAGE_ACTIVATED);
- events.add(page);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageDeactivated(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageDeactivated(IPage page) {
- traces.add(PAGE_DEACTIVATED);
- events.add(page);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageAboutToBeOpened(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageAboutToBeOpened(IPage page) {
- traces.add(PAGE_ABOUTTOBEOPENED);
- events.add(page);
- eventCount++;
- }
-
- /**
- * @see org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener#pageAboutToBeClosed(org.eclipse.papyrus.sasheditor.editor.IPage)
- *
- * @param page
- */
- public void pageAboutToBeClosed(IPage page) {
- traces.add(PAGE_ABOUTTOBECLOSED);
- events.add(page);
- eventCount++;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProviderTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProviderTest.java
deleted file mode 100644
index ba345257b71..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashContainerEventsProviderTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.internal;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author dumoulin
- *
- */
-public class SashContainerEventsProviderTest {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#addListener(org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener)}.
- */
- @Test
- public void testAddActiveEditorChangedListener() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageAboutToBeClosedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#removeListener(org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener)}.
- */
- @Test
- public void testRemoveActiveEditorChangedListener() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
- provider.removeListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageAboutToBeClosedEvent(page);
- assertEquals("event not fired", 0, listener.getEventCount());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageOpenedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageOpenedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageOpenedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_OPENED, listener.getTraces().get(0));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageClosedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageClosedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageClosedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_CLOSED, listener.getTraces().get(0));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageAboutToBeOpenedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageAboutToBeOpenedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageAboutToBeOpenedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ABOUTTOBEOPENED, listener.getTraces().get(0));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageAboutToBeClosedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageAboutToBeClosedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageAboutToBeClosedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ABOUTTOBECLOSED, listener.getTraces().get(0));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageActivatedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageActivatedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageActivatedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ACTIVATED, listener.getTraces().get(0));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageDeactivatedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageDeactivatedEvent() {
- SashContainerEventsProvider provider = new SashContainerEventsProvider();
-
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- provider.addListener(listener);
-
- // Use a null page, as it is not possible to instanciate a fake page.
- PagePart page = null;
-
- // Send an event and check that it is received. If received, the listener is register !
- provider.firePageDeactivatedEvent(page);
- assertEquals("event fired", 1, listener.getEventCount());
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_DEACTIVATED, listener.getTraces().get(0));
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerEventsProviderTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerEventsProviderTest.java
deleted file mode 100644
index 212d29e87ac..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerEventsProviderTest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.ISashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.editor.IPage;
-import org.eclipse.papyrus.sasheditor.editor.MessagePartModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * Test the Events provider behaviors when pages are added to the SashContainer.
- *
- * @author cedric dumoulin
- *
- */
-public class SashWindowsContainerEventsProviderTest {
-
- protected Display display;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- if(display != null)
- display.dispose();
- }
-
-
- /**
- *
- * @return
- */
- private Display createDisplay() {
- if(display == null)
- display = new Display();
-
- return display;
-
- }
- /**
- * Create a {@link SashWindowsContainer} to test. Initialize it with provided {@link ISashWindowsContentProvider}.
- *
- * @param contentProvider
- * @return
- */
- protected SashWindowsContainer createSashWindowsContainer(ISashWindowsContentProvider contentProvider) {
-
- display = createDisplay();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
-
- //
- //new ShellEditor(shell);
- SashWindowsContainer sashWindowContainer = new SashWindowsContainer();
-
- sashWindowContainer.setContentProvider(contentProvider);
-
- sashWindowContainer.createPartControl(shell);
- // shell.open();
- return sashWindowContainer;
- }
-
- /**
- * Create a contentProvider.
- *
- * @return
- */
- protected SimpleSashWindowsContentProvider createContentProvider() {
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 8; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- return contentProvider;
- }
-
- /**
- * Lookup a page by its raw model.
- * @param container
- * @param rawModel
- * @return
- */
- protected IPage lookupTabFolderPart(SashWindowsContainer container, Object rawModel) {
-
- LookupModelPageVisitor visitor = new LookupModelPageVisitor(rawModel);
- container.visit(visitor);
- return visitor.result();
- }
-
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#addListener(org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener)}.
- */
- @Test
- public void testAddActiveEditorChangedListener() {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#removeListener(org.eclipse.papyrus.sasheditor.internal.SashContainerEventsListener)}.
- */
- @Test
- public void testRemoveActiveEditorChangedListener() {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageOpenedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageOpenedEvent() {
-
- // Create container and contentProvider
- ISashWindowsContentProvider contentProvider = createContentProvider();
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- // Create listener and attach it
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- container.addLifeCycleListener(listener);
-
- // Do refresh. This fire events
- container.refreshTabs();
- listener.resetChangeCount();
- listener.resetTraces();
-
-
- // Add an editor
- contentProvider.addPage( new MessagePartModel("newPage") );
- container.refreshTabs();
-
- // check events (there is more than the 2 expected)
- assertTrue("event fired", 2<=listener.getEventCount());
- int i=0;
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ABOUTTOBEOPENED, listener.getTraces().get(i++));
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_OPENED, listener.getTraces().get(i++));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageClosedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageClosedEvent() {
- // Create container and contentProvider
- ISashWindowsContentProvider contentProvider = createContentProvider();
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- // Create listener and attach it
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- container.addLifeCycleListener(listener);
-
- // Do refresh. This fire events
- container.refreshTabs();
-
-
- // Add an editor
- IPageModel model = new MessagePartModel("newPage");
- contentProvider.addPage( model );
- container.refreshTabs();
- listener.resetChangeCount();
- listener.resetTraces();
-
- IPage page1 = lookupTabFolderPart(container, model);
- assertNotNull("Page found", page1);
-
- // Close page
- contentProvider.removePage(model);
- container.refreshTabs();
-
- // check events (there is more than the 2 expected)
- assertTrue("event fired", 2<=listener.getEventCount());
-
- assertTrue("close event fired", listener.getEvents().contains(page1));
- assertTrue("close event fired", listener.getTraces().contains(FakeSashContainerEventsListener.PAGE_CLOSED));
- int index = listener.getTraces().indexOf(FakeSashContainerEventsListener.PAGE_CLOSED);
- assertEquals("right page closed", page1, listener.getEvent(index));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageAboutToBeOpenedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageAboutToBeOpenedEvent() {
- // Create container and contentProvider
- ISashWindowsContentProvider contentProvider = createContentProvider();
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- // Create listener and attach it
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- container.addLifeCycleListener(listener);
-
- // Do refresh. This fire events
- container.refreshTabs();
- listener.resetChangeCount();
- listener.resetTraces();
-
-
- // Add an editor
- contentProvider.addPage( new MessagePartModel("newPage") );
- container.refreshTabs();
-
- // check events (there is more than the 2 expected)
- assertTrue("event fired", 2<=listener.getEventCount());
- int i=0;
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ABOUTTOBEOPENED, listener.getTraces().get(i++));
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageAboutToBeClosedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageAboutToBeClosedEvent() {
- // no such event anymore
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageActivatedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageActivatedEvent() {
- // Create container and contentProvider
- SimpleSashWindowsContentProvider contentProvider = createContentProvider();
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- // Create listener and attach it
- FakeSashContainerEventsListener listener = new FakeSashContainerEventsListener();
- container.addLifeCycleListener(listener);
-
- container.refreshTabs();
-
-
- // Add two pages
- IPageModel pageModel1 = new MessagePartModel("newPage1");
- IPageModel pageModel2 = new MessagePartModel("newPage2");
- contentProvider.addPage(pageModel1);
- contentProvider.addPage(pageModel2);
-
-
- // Do refresh. This fire events
- container.refreshTabs();
- listener.resetChangeCount();
- listener.resetTraces();
-
- // Activate page 1
- IPage page1 = lookupTabFolderPart(container, pageModel1);
- container.selectPage(page1);
-
- // check events (there is more than the 2 expected)
- assertEquals("event fired", 1, listener.getEventCount());
- int i=0;
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ACTIVATED, listener.getTraces().get(i++));
-
- // ****************
- // Check with a move
- listener.resetChangeCount();
- listener.resetTraces();
-
- ITabFolderModel folderModel = contentProvider.getCurrentTabFolder();
- contentProvider.createFolder(folderModel, 1, folderModel, SWT.TOP);
-
- // Do refresh. This fire events
- container.refreshTabs();
- // check events (there is more events than the 1 expected)
- assertTrue("event fired", 1 <= listener.getEventCount());
-// assertEquals("event fired", 1, listener.getEventCount());
- i=0;
- assertEquals("right event", FakeSashContainerEventsListener.PAGE_ACTIVATED, listener.getTraces().get(i++));
-
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashContainerEventsProvider#firePageDeactivatedEvent(org.eclipse.papyrus.sasheditor.internal.PagePart)}.
- */
- @Test
- public void testFirePageDeactivatedEvent() {
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerTest.java b/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerTest.java
deleted file mode 100644
index 7f23a273e74..00000000000
--- a/plugins/core/org.eclipse.papyrus.sasheditor/test/org/eclipse/papyrus/sasheditor/internal/SashWindowsContainerTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.ISashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.contentprovider.ITabFolderModel;
-import org.eclipse.papyrus.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
-import org.eclipse.papyrus.sasheditor.editor.IComponentPage;
-import org.eclipse.papyrus.sasheditor.editor.IEditorPage;
-import org.eclipse.papyrus.sasheditor.editor.IPage;
-import org.eclipse.papyrus.sasheditor.editor.IPageVisitor;
-import org.eclipse.papyrus.sasheditor.editor.MessagePartModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * Run as normal test.
- *
- * Can't be run as plugin test.
- *
- * @author dumoulin
- *
- */
-public class SashWindowsContainerTest extends TestCase {
-
-
- protected Display display;
-
- /**
- * Constructor.
- *
- * @param name
- */
- public SashWindowsContainerTest(String name) {
- super(name);
- }
-
- /**
- * @see junit.framework.TestCase#setUp()
- * @throws java.lang.Exception
- *
- */
- protected void setUp() throws Exception {
- super.setUp();
-
-
- }
-
- /**
- *
- * @return
- */
- protected Shell createShell() {
-
- Shell shell;
-
- try {
- // Initialize display from the workbench if we are started as plugin
- // This is not enough, because we aren't in the right thread :-(.
- // As a consequence, this doesn't work.
- display = PlatformUI.getWorkbench().getDisplay();
-
- } catch (Exception e) {
- // create a display if we are started as java code
- display = new Display();
- }
-
- shell = new Shell(display);
- return shell;
-
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- * @throws java.lang.Exception
- *
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- if( display != null)
- display.dispose();
- }
-
- /**
- * Create a {@link SashWindowsContainer} to test. Initialize it with provided {@link ISashWindowsContentProvider}.
- *
- * @param contentProvider
- * @return
- */
- protected SashWindowsContainer createSashWindowsContainer(ISashWindowsContentProvider contentProvider) {
- Shell shell = createShell();
- shell.setLayout(new FillLayout());
-
- //
- //new ShellEditor(shell);
- SashWindowsContainer sashWindowContainer = new SashWindowsContainer();
-
- sashWindowContainer.setContentProvider(contentProvider);
-
- sashWindowContainer.createPartControl(shell);
- // shell.open();
- return sashWindowContainer;
- }
-
- /**
- * Create a contentProvider.
- *
- * @return
- */
- protected ISashWindowsContentProvider createContentProvider() {
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 8; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- return contentProvider;
- }
-
- /**
- * Test the method on a model with several folders and page.
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
- */
- public void testGetActiveEditor() {
- // Create
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 2; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- // Create new folder
- ITabFolderModel folder = contentProvider.getCurrentTabFolder();
- contentProvider.createFolder(folder, 1, folder, SWT.TOP);
-
- // Get the active editor
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
- IPage page = container.getActiveSashWindowsPage();
- assertNotNull("Page exist", page);
- }
-
- /**
- * Test the method on a model with no pages.
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
- */
- public void testGetActiveEditorNoPage() {
- // Create
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
-
- // Get the active editor
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
- IPage page = container.getActiveSashWindowsPage();
- assertNull("No Page exist", page);
- }
-
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer#refreshTabs()}.
- */
- public void testRefreshTabs() {
-
- ISashWindowsContentProvider contentProvider = createContentProvider();
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- container.refreshTabs();
- assertNotNull("container is set", container);
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer#refreshTabs()}.
- */
- public void testRefreshTabs2() {
-
- // Test 2 folders, one tab each. Then supress one tabs.
- // 1 folder with one tab should remain.
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 2; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- // Create new folder
- ITabFolderModel folder = contentProvider.getCurrentTabFolder();
- contentProvider.createFolder(folder, 1, folder, SWT.TOP);
-
- // Create the container
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
- container.refreshTabs();
- assertNotNull("container is set", container);
-
- }
-
- /**
- * Test method for {@link SashWindowsContainer#visit(org.eclipse.papyrus.sasheditor.editor.IPageVisitor)}
- */
- public void testVisit() {
- // Create
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 2; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- // Create new folder
- ITabFolderModel folder = contentProvider.getCurrentTabFolder();
- contentProvider.createFolder(folder, 1, folder, SWT.TOP);
-
- // Get the active editor
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- CollectRawModelVisitor pageVisitor = new CollectRawModelVisitor();
- container.visit(pageVisitor);
-
- // Check each elements
- Collection<Object> results = pageVisitor.collected;
- assertEquals("list are of same size", models.size(), results.size());
- for(Object model : models) {
- assertTrue("model is in the collected list", results.contains(model));
- }
- }
-
- protected class CollectRawModelVisitor implements IPageVisitor {
-
- Collection<Object> collected = new ArrayList<Object>();
-
- public void accept(IComponentPage page) {
- collected.add(page.getRawModel());
- }
-
- public void accept(IEditorPage page) {
- collected.add(page.getRawModel());
- }
- }
-
- /**
- * Test the lookup of a page by its raw model
- * Test method for {@link SashWindowsContainer#lookupModelPage(Object)}
- */
- public void testlookupModelPage() {
- // Create
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 2; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- // Create new folder
- ITabFolderModel folder = contentProvider.getCurrentTabFolder();
- contentProvider.createFolder(folder, 1, folder, SWT.TOP);
-
- // Get the active editor
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
-
- Object model = models.get(1);
- IPage foundPage = container.lookupModelPage(model);
- assertEquals("Corresponding page is found", foundPage.getRawModel(), model);
- }
-
- /**
- * Test method for {@link SashWindowsContainer#setFolderTabMenuManager(MenuManager)}
- */
- public void testSetFolderTabMenuManager_MenuManager() {
- // Create
- SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
-
- // Create pages and add them to the default folder
- List<IPageModel> models = new ArrayList<IPageModel>();
- for(int i = 0; i < 2; i++) {
- IPageModel newModel = new MessagePartModel("model" + i);
- contentProvider.addPage(newModel);
- models.add(newModel);
- }
-
- // Create new folders
- ITabFolderModel referenceFolder = contentProvider.getCurrentTabFolder();
- ITabFolderModel folder1 = contentProvider.createFolder(referenceFolder, SWT.TOP);
- ITabFolderModel folder2 = contentProvider.createFolder(referenceFolder, SWT.DOWN);
- ITabFolderModel folder3 = contentProvider.createFolder(referenceFolder, SWT.LEFT);
-
- // Create SashWindowsContainer
- SashWindowsContainer container = createSashWindowsContainer(contentProvider);
- // Set a MenuManager
- MenuManager menuManager = new MenuManager();
- container.setFolderTabMenuManager(menuManager);
-
- // Test if the menu has been set in already created folders.
- TabFolderPart folderPart = lookupTabFolderPart(container, referenceFolder);
- assertNotNull("menu exist", folderPart.getControl().getMenu() );;
-
- folderPart = lookupTabFolderPart(container, folder1);
- assertNotNull("menu exist", folderPart.getControl().getMenu() );;
-
- folderPart = lookupTabFolderPart(container, folder2);
- assertNotNull("menu exist", folderPart.getControl().getMenu() );;
-
- folderPart = lookupTabFolderPart(container, folder3);
- assertNotNull("menu exist", folderPart.getControl().getMenu() );;
-
-
- // Now create another tab, refresh the container in order that the part is created,
- // ant test it
- ITabFolderModel folder4 = contentProvider.createFolder(referenceFolder, SWT.RIGHT);
- container.refreshTabs();
-
- folderPart = lookupTabFolderPart(container, folder4);
- assertNotNull("menu exist", folderPart.getControl().getMenu() );;
-
- }
-
- protected TabFolderPart lookupTabFolderPart(SashWindowsContainer container, Object rawModel) {
-
- LookupFolderPartByRawModelVisitor visitor = new LookupFolderPartByRawModelVisitor(rawModel);
- container.visit(visitor);
- return visitor.result();
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/plugin.xml b/plugins/core/org.eclipse.papyrus.service.creation/plugin.xml
deleted file mode 100644
index fde86bb6841..00000000000
--- a/plugins/core/org.eclipse.papyrus.service.creation/plugin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.papyrus.core.service">
- <service
- classname="org.eclipse.papyrus.service.creation.CommandProviderService"
- priority="1"
- startKind="lazy"
- useClassTypeAsKey="true">
- </service>
- </extension>
-
-</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/BaseCommandProvider.java b/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/BaseCommandProvider.java
deleted file mode 100644
index 912c9069b85..00000000000
--- a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/BaseCommandProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.service.creation;
-
-import org.eclipse.papyrus.core.services.ComposedServicePart;
-
-
-/**
- * Base class for CommandProviders.
- * CommandProviders can subclass this base class. This will register them automatically to the main
- * service.
- * CommandProviders should also register themselves to the ServiceRegistry.
- *
- *
- * @author cedric dumoulin
- *
- */
-public abstract class BaseCommandProvider extends ComposedServicePart<CommandProviderService> implements ICommandProvider {
-
-
- /**
- *
- * Constructor.
- *
- */
- public BaseCommandProvider() {
- // create the parent by providing the key of the main service.
- super(CommandProviderService.class);
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/CommandProviderService.java b/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/CommandProviderService.java
deleted file mode 100644
index 704648df6f3..00000000000
--- a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/CommandProviderService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.service.creation;
-
-import org.eclipse.papyrus.core.services.ComposedService;
-
-/**
- * Main service providing Creation Commands.
- * This service delegate to sub-services.
- * Each sub-service register itself to this main service.
- * This service is registered under its classname.
- *
- * @author cedric dumoulin
- *
- */
-public class CommandProviderService extends ComposedService<ICommandProvider> {
-
-
- /**
- * An example of method to get a command.
- * TODO: provide real methods !
- * @param param
- * @return
- */
- public Object getCommands(Object param) {
-
- // Walk each provider to find one providing the command.
- for( ICommandProvider provider : getRegisteredServices() )
- {
- Object res = provider.getCommands(param);
- if(res != null)
- return res;
-
- }
-
- return null;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/ICommandProvider.java b/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/ICommandProvider.java
deleted file mode 100644
index 0d400639975..00000000000
--- a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/ICommandProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.service.creation;
-
-
-/**
- * Interface providing methods to get Commands
- * This interface is implemented by CommandProvider.
- *
- * @author cedric dumoulin
- *
- */
-public interface ICommandProvider {
-
- /**
- * An example of method to get a command.
- * TODO: provide real methods !
- * @param param
- * @return
- */
- public Object getCommands(Object param);
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/utils/CreationServiceUtils.java b/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/utils/CreationServiceUtils.java
deleted file mode 100644
index e02cc26a3b8..00000000000
--- a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/utils/CreationServiceUtils.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.papyrus.service.creation.utils;
-
-
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.papyrus.service.creation.CommandProviderService;
-
-/**
- * Utility class to find the CreationService
- * @author cedric dumoulin
- *
- */
-public class CreationServiceUtils {
-
-
- /**
- * Get the CommandProviderService associated to the current active editor.
- *
- * @return The CommandProviderService, or null if not found.
- */
- public static CommandProviderService getCommandProvider() {
-
- ServicesRegistry serviceRegistry = EditorUtils.getServiceRegistry();
- try {
- return serviceRegistry == null ? null : serviceRegistry.getService(CommandProviderService.class);
- } catch (ServiceException e) {
- return null;
- }
-
- }
-
- /**
- * Get the CommandProviderService associated to the current active editor.
- *
- * @return The CommandProviderService
- * @throws ServiceException If an error occurs.
- */
- public static CommandProviderService getCommandProviderChecked() throws ServiceException {
-
- return EditorUtils.getServiceRegistryChecked().getService(CommandProviderService.class);
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/.classpath b/plugins/core/org.eclipse.papyrus.service.edit/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/.project b/plugins/core/org.eclipse.papyrus.service.edit/.project
new file mode 100644
index 00000000000..d109a612a29
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.service.edit</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/plugins/core/org.eclipse.papyrus.service.creation/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.service.edit/META-INF/MANIFEST.MF
index 8357f5163a9..dc97d0d71f3 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.service.edit/META-INF/MANIFEST.MF
@@ -1,14 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.service.creation;singleton:=true
-Bundle-Version: 0.7.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.service.creation.Activator
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.service.edit;singleton:=true
+Bundle-Version: 0.7.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.service.edit.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.core;bundle-version="0.7.0";visibility:=reexport
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.service.creation,
- org.eclipse.papyrus.service.creation.utils
+Export-Package: org.eclipse.papyrus.service.edit,
+ org.eclipse.papyrus.service.edit.service
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/about.html b/plugins/core/org.eclipse.papyrus.service.edit/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/build.properties b/plugins/core/org.eclipse.papyrus.service.edit/build.properties
index 73a5119ed93..bf63961e45d 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/build.properties
+++ b/plugins/core/org.eclipse.papyrus.service.edit/build.properties
@@ -3,4 +3,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
- plugin.xml
+ plugin.xml,\
+ build.properties,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/plugin.properties b/plugins/core/org.eclipse.papyrus.service.edit/plugin.properties
index f14460f8ae8..65ff3906fe0 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.service.edit/plugin.properties
@@ -1,5 +1,5 @@
#################################################################################
-# Copyright (c) 2008 CEA LIST.
+# Copyright (c) 2010 CEA LIST.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
#
# Contributors:
# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+# Yann Tanguy yann.tanguy@cea.fr - GMF Runtime based edit service for model type
##################################################################################
-pluginName=Papyrus Creation Service
-providerName=Eclipse.org
+pluginName=Papyrus Edit Service (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/plugin.xml b/plugins/core/org.eclipse.papyrus.service.edit/plugin.xml
new file mode 100644
index 00000000000..ed590b73ab5
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/plugin.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+
+ <!-- Papyrus single IClientContext declaration
+ This context can only be used explicitely as its matcher always return false ( in order
+ to avoid undesired activation and possible side effects)
+ -->
+ <clientContext id="org.eclipse.papyrus.service.edit.TypeContext">
+ <matcher class="org.eclipse.papyrus.service.edit.matcher.NoContextEnablementMatcher"/>
+ </clientContext>
+
+</extension>
+
+<!-- Binds general (non-UML specific) advices
+
+ The notation dependant advice add a View deletion command for any View that references
+ the EObject currently destroyed.
+
+ Both the following advices are commonly used by GMF Runtime (and code generated by the tooling):
+ - org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents
+ - org.eclipse.gmf.runtime.diagram.core.advice.removeBookmarks
+
+ The cross referencer is used to find any View referencing and EObject, as far as the Notation file
+ is loaded (does not mean each diagram is opened), every view related to an element will be deleted
+ with the element deletion. These views may possibly be located in different diagrams.
+
+ These advices are generally always added to the GMF default context. As the use of the extensible
+ type framework in Papyrus is currently used with an explicit unique context, it is important
+ to add these advices to this shared context to ensure the views are correctly deleted.
+
+ -->
+<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+
+ <!-- Bindings declaration -->
+ <binding context="org.eclipse.papyrus.service.edit.TypeContext">
+
+ <!-- ElementType that deals with View deletion when their related model element is deleted -->
+ <elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.removeBookmarks"/>
+
+ </binding>
+
+</extension>
+
+<!-- Declaration of the IElementEditServiceProvider (Papyrus wrapper to the Extensible type framework) -->
+<extension point="org.eclipse.papyrus.core.service">
+ <service
+ id="org.eclipse.papyrus.service.edit.service.IElementEditServiceProvider"
+ classname="org.eclipse.papyrus.service.edit.internal.ElementEditServiceProviderFactory"
+ priority="1" startKind="startup">
+ </service>
+</extension>
+
+
+</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/Activator.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/Activator.java
index acfd8ffb7b7..ded8b534cbf 100644
--- a/plugins/core/org.eclipse.papyrus.service.creation/src/org/eclipse/papyrus/service/creation/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/Activator.java
@@ -1,5 +1,20 @@
-package org.eclipse.papyrus.service.creation;
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit;
+import org.eclipse.papyrus.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -8,29 +23,33 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.service.creation"; //$NON-NLS-1$
+ /** Plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.service.edit"; //$NON-NLS-1$
- // The shared instance
+ /** Shared instance */
private static Activator plugin;
-
- /**
- * The constructor
- */
+
+ /** Default constructor */
public Activator() {
}
+ /** Logging helper */
+ public static LogHelper log;
+
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(plugin);
}
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -40,7 +59,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/context/TypeContext.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/context/TypeContext.java
new file mode 100644
index 00000000000..a15f622f1b4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/context/TypeContext.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.context;
+
+import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.core.services.ServiceException;
+
+/**
+ * <pre>
+ * The centralized model type edit service relies on GMF Runtime extensible
+ * type framework, used via a single common {@link IClientContext} on which
+ * the various {@link IElementType} used by Papyrus are registered.
+ *
+ * This class stores this context ID and provides a convenient API to
+ * get the {@link IClientContext} from the {@link ClientContextManager}.
+ * </pre>
+ */
+public class TypeContext {
+
+ /** The ID of Papyrus {@link IClientContext} (declared in plugin.xml, shall not be modified) */
+ private static final String ID = "org.eclipse.papyrus.service.edit.TypeContext"; //$NON-NLS-1$
+
+ /**
+ * Retrieve Papyrus {@link IClientContext} from its ID.
+ *
+ * @return the tool context
+ * @throws Exception
+ * if the context is not found
+ */
+ public static IClientContext getContext() throws ServiceException {
+
+ IClientContext context = ClientContextManager.getInstance().getClientContext(ID);
+ if(context == null) {
+ throw new ServiceException("Could not retrieve Papyrus context (GMF Extensible Type IClientContext): " + ID + ".");
+ }
+
+ return context;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditService.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditService.java
new file mode 100644
index 00000000000..05eddef6a0e
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditService.java
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.internal;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+
+/**
+ * <pre>
+ *
+ * This class implements {@link IElementEditService}.
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditService
+ *
+ * This class is the service in charge of providing edit command for
+ * a specific type of element.
+ *
+ * This class relies for a large part on the GMF ExtensibleType framework,
+ * mostly as a wrapper of {@link IElementType} for Papyrus. No added value
+ * for Papyrus is expected in using this wrapper, except the fact that it ensures
+ * Papyrus shared {@link IClientContext} is always explicitly used or set in
+ * request while retrieving commands.
+ *
+ * </pre>
+ */
+public class ElementEditService implements IElementEditService {
+
+ /** The registered {@link IElementType} used to provide edit commands. */
+ protected IElementType elementType;
+
+ /** Papyrus shared {@link IClientContext} */
+ protected IClientContext sharedClientContext;
+
+ /**
+ * <pre>
+ *
+ * Constructor.
+ *
+ * @param elementType the {@link IElementType} this service will use to provide edit commands
+ * @param sharedClientContext the shared {@link IClientContext}
+ *
+ * </pre>
+ */
+ public ElementEditService(IElementType elementType, IClientContext sharedClientContext) {
+ super();
+ this.elementType = elementType;
+ this.sharedClientContext = sharedClientContext;
+ }
+
+ /**
+ * <pre>
+ *
+ * This method creates an edit command in response to an edit request.
+ * This method directly uses the ElementType framework (through {@link IElementType} api,
+ * making sure that the Papyrus shared {@link IClientContext} is explicitly set in the request.
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditService#getEditCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
+ *
+ * @param request the edit request
+ * @return the edit command corresponding to the edit request
+ *
+ * </pre>
+ */
+ public ICommand getEditCommand(IEditCommandRequest request) {
+ // Make sure the share client context in passed in the request
+ request.setClientContext(sharedClientContext);
+
+ // Retrieve the desired edit command using GMF ExtensibleType API
+ ICommand editCommand = elementType.getEditCommand(request);
+
+ return editCommand;
+ }
+
+ /**
+ * <pre>
+ *
+ * Get the display name of the element type.
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditService#getDisplayName()
+ *
+ * @return the display name of the {@link IElementType} used by current service.
+ *
+ * </pre>
+ */
+ public String getDisplayName() {
+ return elementType.getDisplayName();
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ *
+ * @param adapter
+ * @return the adapted object
+ */
+ public Object getAdapter(Class adapter) {
+ if(adapter == IElementType.class) {
+ return elementType;
+ }
+ return null;
+ }
+
+ /**
+ * <pre>
+ *
+ * Test if current service can provide an edit command in response to the request.
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditService#canEdit(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
+ *
+ * @param req the edit request to test
+ * @return true is this service can provide edit command for the request
+ *
+ * </pre>
+ */
+ public boolean canEdit(IEditCommandRequest req) {
+ // Make sure the share client context in passed in the request
+ req.setClientContext(sharedClientContext);
+
+ return elementType.canEdit(req);
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProvider.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProvider.java
new file mode 100644
index 00000000000..2b171339bf4
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProvider.java
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.service.edit.context.TypeContext;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+import org.eclipse.papyrus.service.edit.service.IElementEditServiceProvider;
+
+/**
+ * <pre>
+ *
+ * This provider wrap {@link ElementTypeRegistry} especially to provide a Papyrus-like
+ * service provider.
+ * This class is a singleton that may be access directly or via Papyrus service registry.
+ * Note that this provider does not necessary need Papyrus to be the active editor to be available
+ * (it relies on {@link ElementTypeRegistry} which is independant from Papyrus.
+ *
+ * It is registered as Papyrus service with the {@link ElementEditServiceProviderFactory}.
+ *
+ * </pre>
+ */
+public class ElementEditServiceProvider implements IElementEditServiceProvider {
+
+ /** Papyrus shared {@link IClientContext} */
+ protected IClientContext sharedClientContext;
+
+ /** Singleton instance */
+ private static IElementEditServiceProvider instance;
+
+ /** Default constructor */
+ private ElementEditServiceProvider() throws ServiceException {
+ this.sharedClientContext = TypeContext.getContext();
+ }
+
+ /** Get singleton instance */
+ public static synchronized IElementEditServiceProvider getInstance() throws ServiceException {
+ if(instance == null) {
+ instance = new ElementEditServiceProvider();
+ }
+
+ return instance;
+ }
+
+ /**
+ * <pre>
+ *
+ * This method try to retrieve the correct edit service for an object.
+ *
+ * It relies on GMF {@link ElementTypeRegistry} which provides the {@link IElementType} registered
+ * in the Extensible type framework for the object passed in parameter. The found element type is returned
+ * wrapped as an {@link IElementEditService}.
+ *
+ * The {@link IElementType} are registered in separate plug-ins (e.g. oep.uml.service.types for all types
+ * related to UML metaclasses).
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditServiceProvider#getEditService(java.lang.Object)
+ *
+ * @param objectToEdit the object for which this method tries to retrieve an edit service
+ * @return the {@link IElementEditService} for the passed object
+ * @throws ServiceException
+ *
+ * </pre>
+ */
+ public IElementEditService getEditService(Object objectToEdit) throws ServiceException {
+
+ if(!(objectToEdit instanceof EObject) && !(objectToEdit instanceof EClass)) {
+ throw new ServiceException("EObject or EClass expected in method parameter.");
+ }
+
+ IElementType elementType = null;
+
+ if(objectToEdit instanceof EObject) {
+ elementType = ElementTypeRegistry.getInstance().getElementType((EObject)objectToEdit, sharedClientContext);
+ }
+
+ if(objectToEdit instanceof EClass) {
+ elementType = ElementTypeRegistry.getInstance().getElementType((EClass)objectToEdit, sharedClientContext);
+ }
+
+ if(elementType == null) {
+ throw new ServiceException("No IElementType bound to Papyrus shared client context for " + objectToEdit + ".");
+ }
+
+ return new ElementEditService(elementType, sharedClientContext);
+ }
+
+ /**
+ * <pre>
+ *
+ * This method returns the registered {@link IElementType} (wrapped as {@link IElementEditService}) that may be contained by
+ * the eContainer parameter for the specific reference parameter.
+ *
+ * @see org.eclipse.papyrus.service.edit.service.IElementEditServiceProvider#getContainedTypeEditServices(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EReference)
+ *
+ * @param eContainer
+ * @param reference
+ * @return the list of possibly contained {@link IElementEditService}
+ * @throws ServiceException
+ * </pre>
+ */
+ public List<IElementEditService> getContainedTypeEditServices(EObject eContainer, EReference reference) throws ServiceException {
+ List<IElementEditService> services = new ArrayList<IElementEditService>();
+
+ for(IElementType type : ElementTypeRegistry.getInstance().getContainedTypes(eContainer, reference, sharedClientContext)) {
+ services.add(new ElementEditService(type, sharedClientContext));
+ }
+
+ return services;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProviderFactory.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProviderFactory.java
new file mode 100644
index 00000000000..de53dd35696
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/internal/ElementEditServiceProviderFactory.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.internal;
+
+import org.eclipse.papyrus.core.services.IServiceFactory;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.service.edit.service.IElementEditServiceProvider;
+
+/** Papyrus factory that provides ElementEditServiceProvider */
+public class ElementEditServiceProviderFactory implements IServiceFactory {
+
+ /** Default constructor */
+ public ElementEditServiceProviderFactory() {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.services.IService#init(org.eclipse.papyrus.core.services.ServicesRegistry)
+ *
+ * @param servicesRegistry
+ * @throws ServiceException
+ */
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.services.IService#startService()
+ *
+ * @throws ServiceException
+ */
+ public void startService() throws ServiceException {
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.services.IService#disposeService()
+ *
+ * @throws ServiceException
+ */
+ public void disposeService() throws ServiceException {
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.services.IServiceFactory#createServiceInstance()
+ *
+ * @return the singleton instance of {@link IElementEditServiceProvider}
+ * @throws ServiceException
+ */
+ public Object createServiceInstance() throws ServiceException {
+ return ElementEditServiceProvider.getInstance();
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/matcher/NoContextEnablementMatcher.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/matcher/NoContextEnablementMatcher.java
new file mode 100644
index 00000000000..5695f138fee
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/matcher/NoContextEnablementMatcher.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.matcher;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher;
+
+/**
+ * This matcher is used to always disable the context where the semantic
+ * creation service are defined.
+ * This means the the creation service requires to be called which explicit
+ * context specification.
+ *
+ * This is a temporary matcher implementation used in order to avoid undesired
+ * side effects from the centralized edit service and any possible use of
+ * GMF extensible type framework made by diagram (either Papyrus or not) GMF tooling
+ * generated diagrams.
+ */
+public class NoContextEnablementMatcher implements IElementMatcher {
+
+ public boolean matches(EObject eObject) {
+ return false;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/ElementEditServiceUtils.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/ElementEditServiceUtils.java
new file mode 100644
index 00000000000..350f1cc0a77
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/ElementEditServiceUtils.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.service;
+
+
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.utils.ServiceUtils;
+import org.eclipse.papyrus.service.edit.Activator;
+import org.eclipse.papyrus.service.edit.internal.ElementEditServiceProvider;
+
+/**
+ * <pre>
+ *
+ * Utility class for a convenient access to edit services.
+ *
+ * </pre>
+ */
+public class ElementEditServiceUtils {
+
+ /**
+ * <pre>
+ * Try to retrieve an edit service for the object in parameter
+ * (EObject or EClass expected).
+ *
+ * Current implementation directly use {@link IElementEditServiceProvider} instance
+ * rather than using Papyrus {@link ServiceUtils} which requires Papyrus to be
+ * the active editor.
+ *
+ * @param objectToEdit
+ * @return the edit service or null
+ * </pre>
+ */
+ public static IElementEditService getCommandProvider(Object objectToEdit) {
+
+ try {
+ return getEditServiceProvider().getEditService(objectToEdit);
+ } catch (ServiceException e) {
+ Activator.log.error("Unable to get ElementType edit service for " + objectToEdit + ".", e);
+ } catch (NullPointerException e) {
+ Activator.log.error("Unable to get ElementType edit service for " + objectToEdit + ".", e);
+ }
+
+ return null;
+
+ //ServicesRegistry serviceRegistry = EditorUtils.getServiceRegistry();
+ // try {
+ // IElementEditServiceProvider serviceProvider = serviceRegistry.getService(IElementEditServiceProvider.class);
+ // IElementEditService service = serviceProvider.getEditService(objectToEdit);
+ // return serviceRegistry == null ? null : service;
+ // } catch (ServiceException e) {
+ // return null;
+ // }
+ }
+
+ /**
+ * <pre>
+ * Get the edit service provider (using {@link ElementTypeRegistry} instead of
+ * {@link ServiceUtils}). Note that {@link ServiceUtils} would return the same instance
+ * anyway.
+ *
+ * @return the service provider
+ * </pre>
+ */
+ public static IElementEditServiceProvider getEditServiceProvider() {
+
+ try {
+ return getEditServiceProviderFromElementTypeRegistry();
+ } catch (ServiceException e) {
+ Activator.log.error("Unable to get ElementType edit service provider.", e);
+ }
+
+ return null;
+
+ // ServicesRegistry serviceRegistry = EditorUtils.getServiceRegistry();
+ // try {
+ // IElementEditServiceProvider serviceProvider = serviceRegistry.getService(IElementEditServiceProvider.class);
+ // return serviceRegistry == null ? null : serviceProvider;
+ // } catch (ServiceException e) {
+ // return null;
+ // }
+ }
+
+ /**
+ * Get the element edit service provider from the {@link ElementTypeRegistry}.
+ *
+ * @return the element edit service
+ * @throws ServiceException
+ */
+ protected static IElementEditServiceProvider getEditServiceProviderFromElementTypeRegistry() throws ServiceException {
+ return ElementEditServiceProvider.getInstance();
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditService.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditService.java
new file mode 100644
index 00000000000..e1228116402
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditService.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.service;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+
+/**
+ * <pre>
+ *
+ * This interface provide the public API for edit service in Papyrus.
+ *
+ * Currently the implementation mostly rely on GMF extensible type framework,
+ * which was used as the basis to identify methods in this interface (also, it is
+ * currently the only proposed implementation of the edit service for Papyrus.
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.IElementType
+ *
+ * </pre>
+ */
+public interface IElementEditService extends IAdaptable {
+
+ /**
+ * <pre>
+ *
+ * Test if the service can fullfil the request in parameter.
+ *
+ * @see {@link IElementType#canEdit(IEditCommandRequest)}
+ *
+ * @param req the edit request
+ * @return true if the service can fulfill the request in parameter
+ *
+ * </pre>
+ */
+ public boolean canEdit(IEditCommandRequest req);
+
+ /**
+ * <pre>
+ *
+ * Get the edit command that fulfills the edit request
+ *
+ * @see {@link IElementType#getEditCommand(IEditCommandRequest)}
+ *
+ * @param request the edit request
+ * @return the edit command
+ *
+ * </pre>
+ */
+ public ICommand getEditCommand(IEditCommandRequest request);
+
+ /**
+ * <pre>
+ *
+ * Get the display name associated to the element related to the edit service.
+ *
+ * @see {@link IElementType#getDisplayName()}
+ *
+ * @return the display name
+ *
+ * </pre>
+ */
+ public String getDisplayName();
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditServiceProvider.java b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditServiceProvider.java
new file mode 100644
index 00000000000..695c1d546ff
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.service.edit/src/org/eclipse/papyrus/service/edit/service/IElementEditServiceProvider.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.service.edit.service;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.service.edit.internal.ElementEditServiceProvider;
+
+/**
+ * <pre>
+ *
+ * This interface shows a public API for accessing edit service related to model elements.
+ *
+ * Class implementing this interface:
+ * @see ElementEditServiceProvider
+ *
+ * </pre>
+ */
+public interface IElementEditServiceProvider {
+
+ /**
+ * <pre>
+ *
+ * Get the registered edit service for the object in parameter
+ *
+ * @param objectToEdit the object to edit (an EObject of EClass)
+ * @return the edit service
+ * @throws ServiceException
+ * </pre>
+ */
+ public IElementEditService getEditService(Object objectToEdit) throws ServiceException;
+
+ /**
+ * <pre>
+ *
+ * Get the edit services for any element registered that are possibly contained by the owner under
+ * the desired containment reference.
+ *
+ * @param owner the owner or the element to edit
+ * @param containmentReference the containment reference
+ * @return a list of edit services
+ * @throws ServiceException
+ * </pre>
+ */
+ public List<IElementEditService> getContainedTypeEditServices(EObject owner, EReference containmentReference) throws ServiceException;
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF
index 54aa6f72e14..f469ba42918 100644
--- a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.tabbedproperties.core;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.4.0",
org.eclipse.papyrus.core;bundle-version="0.7.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/build.properties b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/build.properties
index 2c1062f6280..bd63f2432f0 100644
--- a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/build.properties
+++ b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/build.properties
@@ -4,6 +4,7 @@ bin.includes = META-INF/,\
.,\
plugin.properties,\
about.html,\
- plugin.xml
+ plugin.xml,\
+ build.properties
src.includes = about.html
diff --git a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/plugin.properties b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/plugin.properties
index 23a48cbad83..26bfbb06fd2 100644
--- a/plugins/core/org.eclipse.papyrus.tabbedproperties.core/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.tabbedproperties.core/plugin.properties
@@ -9,4 +9,4 @@
# Remi Schnekenburger - CEA LIST (remi.schnekenburger@cea.fr) - Initial API and implementation
##################################################################################
pluginName=Papyrus Core Tabbed Properties (Incubation)
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
diff --git a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/META-INF/MANIFEST.MF
index ce024d24e0d..caf25965c94 100644
--- a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.papyrus.ui.perspectiveconfiguration;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.ui.perspectiveconfiguration.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
diff --git a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/about.html b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/build.properties b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/build.properties
index 6f20375d6c7..da14373e606 100644
--- a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/build.properties
+++ b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/build.properties
@@ -2,4 +2,8 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ build.properties,\
+ plugin.properties,\
+ schema/,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/plugin.properties b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/plugin.properties
index 0f2902f6081..e33a3ee580f 100644
--- a/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.ui.perspectiveconfiguration/plugin.properties
@@ -11,6 +11,6 @@
# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
#
########################################################################################
-providerName=Eclipse.org
+providerName=Eclipse Modeling Project
pluginName= UI perpective configuration(Incubation)
diff --git a/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF
index 17631619318..5b31620aaf2 100644
--- a/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.wizards/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.wizards;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.7.1.qualifier
Bundle-Activator: org.eclipse.papyrus.wizards.Activator
Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.7.0",
org.eclipse.emf.edit.ui;bundle-version="2.4.0",
diff --git a/plugins/core/org.eclipse.papyrus.wizards/build.properties b/plugins/core/org.eclipse.papyrus.wizards/build.properties
index 9f897e754e4..5e4a2542804 100644
--- a/plugins/core/org.eclipse.papyrus.wizards/build.properties
+++ b/plugins/core/org.eclipse.papyrus.wizards/build.properties
@@ -8,8 +8,4 @@ bin.includes = META-INF/,\
plugin.properties,\
about.html
src.includes = about.html,\
- src/,\
schema/,\
- plugin.xml,\
- META-INF/,\
- .classpath
diff --git a/plugins/core/org.eclipse.papyrus.wizards/plugin.properties b/plugins/core/org.eclipse.papyrus.wizards/plugin.properties
index 450818bda49..56b077e65cf 100644
--- a/plugins/core/org.eclipse.papyrus.wizards/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.wizards/plugin.properties
@@ -9,5 +9,5 @@
# Obeo - initial API and implementation
###############################################################################
pluginName=Papyrus Wizards (Incubation)
-pluginProvider=Eclipse.org
+pluginProvider=Eclipse Modeling Project
NewWizards.project.description=Create a project for a new Papyrus model (UML or SysML)
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.xtext.gmf.glue/META-INF/MANIFEST.MF
index b964ddef9bd..a55b5a2b21f 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/META-INF/MANIFEST.MF
@@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.xtext.ui;bundle-version="0.8.0",
org.eclipse.core.expressions;bundle-version="3.4.100",
org.eclipse.xtext.ui.shared;bundle-version="0.8.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.7.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.7.1",
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.papyrus.sasheditor;bundle-version="0.7.0",
org.eclipse.papyrus.editor;bundle-version="0.7.0",
@@ -22,6 +22,8 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.xtext.gmf.glue,
+ org.eclipse.xtext.gmf.glue.contentassist,
org.eclipse.xtext.gmf.glue.edit.part,
- org.eclipse.xtext.gmf.glue.editingdomain
+ org.eclipse.xtext.gmf.glue.editingdomain,
+ org.eclipse.xtext.gmf.glue.partialEditing
Import-Package: org.apache.log4j;version="1.2.15"
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/about.html b/plugins/core/org.eclipse.xtext.gmf.glue/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/build.properties b/plugins/core/org.eclipse.xtext.gmf.glue/build.properties
index e9863e281ea..786b1df9364 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/build.properties
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/build.properties
@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ about.html
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/PopupEditorConfiguration.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/PopupEditorConfiguration.java
index 760d38ef05c..939e12d909f 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/PopupEditorConfiguration.java
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/PopupEditorConfiguration.java
@@ -21,6 +21,7 @@ import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorCon
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.xtext.gmf.glue.edit.part.IXTextSemanticValidator;
import org.eclipse.xtext.gmf.glue.edit.part.IXtextEMFReconciler;
import org.eclipse.xtext.gmf.glue.edit.part.PopupXtextEditorHelper;
@@ -59,24 +60,26 @@ public abstract class PopupEditorConfiguration implements IPopupEditorConfigurat
* Basic implementation which simply consists in returning a new PopupXtextEditorHelper
* @param editPart The editPart on which a direct edit has been performed.
* @param xtextInjector The xtextInjector.
- * @param eobjectContextUpdater The IEObjectContextUpdater, to update the currently edited UML model element
* @param xtextEditorContextUpdater The IXtextEditorContextUpdater, to update the currently select xtext editor
* @param modelReconciler The IXtextEMFReconciler, to update the context UML model with changes textually specified in the popup xtext editor
* @param textToEdit the initialization text, used as the initial textual content for the popup xtext editor
- * @param fileExtension the extension for the temporary textual file (underlying the editor)
+ * @param fileExtension the extension for the temporary textual file (underlying the editor)
+ * @param semanticValidator the semantic validator used to semantically validate the model before saving
* @return IPopupEditorHelper
*/
public IPopupEditorHelper createPopupEditorHelper(IGraphicalEditPart editPart,
Injector xtextInjector,
IXtextEMFReconciler modelReconciler,
String textToEdit,
- String fileExtension) {
+ String fileExtension,
+ IXTextSemanticValidator semanticValidator) {
return new PopupXtextEditorHelper(editPart,
xtextInjector,
modelReconciler,
textToEdit,
- fileExtension);
+ fileExtension,
+ semanticValidator);
}
////
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CompletionProposalUtils.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CompletionProposalUtils.java
new file mode 100644
index 00000000000..9808bef1061
--- /dev/null
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CompletionProposalUtils.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.xtext.gmf.glue.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.core.utils.DisplayUtils;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+
+/**
+ * @author CEA LIST - Initial contribution and API
+ */
+public class CompletionProposalUtils {
+
+ protected final static ILabelProvider labelProvider = DisplayUtils.getLabelProvider() ;
+
+ /**
+ * Public Utility method for creating a completion proposal
+ *
+ * @param namedElement The named element for which completion proposal must be created
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposal(NamedElement namedElement,
+ String completionString,
+ String displayString,
+ ContentAssistContext context) {
+ String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')' ;
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement) , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ additionalProposalInfo, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public Utility method for creating a completion proposal with replacement of prefix
+ *
+ * @param namedElement The named element for which completion proposal must be created
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposalWithReplacementOfPrefix(NamedElement namedElement,
+ String completionString,
+ String displayString,
+ ContentAssistContext context) {
+ String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')' ;
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset() - context.getPrefix().length(), // Offset
+ context.getPrefix().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement) , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ additionalProposalInfo, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public Utility method for creating a completion proposal
+ *
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposal(String completionString,
+ String displayString,
+ ContentAssistContext context) {
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ null , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ null, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public utility method that computes a qualified name, taking into account packages imported by the namespace model
+ *
+ * @param namedElement
+ * @param model
+ * @return the qualified name label
+ */
+ public static String getQualifiedNameLabelWithSufficientDepth(NamedElement namedElement, Namespace model) {
+ String label = "" ;
+
+ List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages()) ;
+
+ List<Namespace> visitedNamespaces = new ArrayList<Namespace>() ;
+ Namespace currentNamespace = namedElement.getNamespace() ;
+
+ boolean rootFound = false ;
+ boolean modelIsTheRoot = false ;
+
+ while (currentNamespace != null && !rootFound) {
+ visitedNamespaces.add(currentNamespace) ;
+ if (importedPackages.contains(currentNamespace) || currentNamespace == model) {
+ rootFound = true ;
+ if (currentNamespace == model)
+ modelIsTheRoot = true ;
+ }
+ Element owner = currentNamespace.getOwner() ;
+ while (owner != null && !(owner instanceof Namespace))
+ owner = owner.getOwner() ;
+
+ currentNamespace = owner != null ? (Namespace)owner : null ;
+ }
+
+ for (int i = visitedNamespaces.size() - 1 - (modelIsTheRoot ? 1 : 0) ; i >= 0 ; i--) {
+ label += visitedNamespaces.get(i).getName() + "::" ;
+ }
+
+ return label + namedElement.getName() ;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CustomCompletionProposal.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CustomCompletionProposal.java
new file mode 100644
index 00000000000..39acb3334dc
--- /dev/null
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/contentassist/CustomCompletionProposal.java
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.xtext.gmf.glue.contentassist;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+
+/**
+ * @author CEA LIST - Initial contribution and API
+ */
+public class CustomCompletionProposal implements ICompletionProposal, ICompletionProposalExtension {
+
+ private CompletionProposal completionProposal ;
+ private int fReplacementOffset ;
+ private ContentAssistContext fContentAssistContext ;
+ private String fReplacementString ;
+
+ /**
+ * @param replacementString
+ * @param replacementOffset
+ * @param replacementLength
+ * @param cursorPosition
+ * @param image
+ * @param displayString
+ * @param contextInformation
+ * @param additionalProposalInfo
+ * @param contentAssistContext
+ *
+ */
+ public CustomCompletionProposal (String replacementString,
+ int replacementOffset,
+ int replacementLength,
+ int cursorPosition,
+ Image image,
+ String displayString,
+ IContextInformation contextInformation,
+ String additionalProposalInfo,
+ ContentAssistContext contentAssistContext) {
+ completionProposal = new CompletionProposal(replacementString,
+ replacementOffset,
+ replacementLength,
+ cursorPosition,
+ image,
+ displayString,
+ contextInformation,
+ additionalProposalInfo) ;
+ fReplacementOffset = replacementOffset ;
+ fReplacementString = replacementString ;
+ fContentAssistContext = contentAssistContext ;
+ }
+
+ public void apply(IDocument document, char trigger, int offset) {
+ try {
+ int length = 0 ;
+ if (offset != fReplacementOffset)
+ length = offset - fReplacementOffset ;
+ else
+ length = fContentAssistContext.getSelectedText().length() ;
+ document.replace(fReplacementOffset ,
+ length,
+ fReplacementString) ;
+ }
+ catch (BadLocationException e) {
+ // ignore
+ }
+ }
+
+ public boolean isValidFor(IDocument document, int offset) {
+ try {
+ int length = offset - fReplacementOffset ;
+ return completionProposal.getDisplayString().toLowerCase().contains(document.get(fReplacementOffset, length).toLowerCase()) ;
+ }
+ catch (BadLocationException e) {
+ // ignore
+ }
+ return false;
+ }
+
+ public char[] getTriggerCharacters() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getContextInformationPosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public void apply(IDocument document) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Point getSelection(IDocument document) {
+ return completionProposal.getSelection(document);
+ }
+
+ public String getAdditionalProposalInfo() {
+ return completionProposal.getAdditionalProposalInfo();
+ }
+
+ public String getDisplayString() {
+ return completionProposal.getDisplayString();
+ }
+
+ public Image getImage() {
+ return completionProposal.getImage();
+ }
+
+ public IContextInformation getContextInformation() {
+ return completionProposal.getContextInformation();
+ }
+
+}
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/DefaultXtextSemanticValidator.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/DefaultXtextSemanticValidator.java
new file mode 100644
index 00000000000..18ce463b768
--- /dev/null
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/DefaultXtextSemanticValidator.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.xtext.gmf.glue.edit.part;
+
+/**
+ * Default implementation for IXtextSemanticValidator.
+ *
+ * @author CEA LIST - Initial contribution and API
+ */
+public class DefaultXtextSemanticValidator implements IXTextSemanticValidator {
+
+ /**
+ * Default implementation. Always returns true.
+ * @return always returns true.
+ */
+ public boolean validate() {
+ return true;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/IXTextSemanticValidator.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/IXTextSemanticValidator.java
new file mode 100644
index 00000000000..02c110a5d8a
--- /dev/null
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/IXTextSemanticValidator.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.xtext.gmf.glue.edit.part;
+
+/**
+ * Optional interface to be implemented by each client plug-in. The validation is taken into account before
+ * closing a textual editor, in order to determine if the model contains semantic errors. If it contains
+ * semantic errors, modifications are not saved in order to avoid corrupting the context UML model.
+ *
+ * @author CEA LIST - Initial contribution and API
+ */
+public interface IXTextSemanticValidator {
+
+
+ /**
+ *
+ * @return Implementations must return true if the xtext model is semantically valid
+ */
+ public boolean validate() ;
+
+}
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
index 02b172d6f12..acd8d8da19a 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorHelper.java
@@ -118,45 +118,59 @@ public class PopupXtextEditorHelper implements IPopupEditorHelper {
private IXtextEMFReconciler modelReconciler;
private ISyntheticResourceProvider resourceProvider ;
private SourceViewerHandle sourceViewerHandle ;
+
+ /**
+ * @return The source viewer handle for this PopupXtextEditorHelper
+ *
+ */
+ public SourceViewerHandle getSourceViewerHandle() {
+ return sourceViewerHandle;
+ }
+
private PartialModelEditor partialEditor ;
private Shell diagramShell ;
private OperationHistoryListener operationHistoryListener;
+ private IXTextSemanticValidator semanticValidator ;
/**
* The context EObject for this editor. It can be used for content assist, verification, etc.
*/
public static EObject context ;
/**
+ *
+ */
+ public static boolean ignoreFocusLost = false ;
+
+ /**
* This element was originally undocumented in the XText/GMF integration example
*
* Modifications performed by CEA LIST
* - Signature changed: was public PopupXtextEditorHelper(IGraphicalEditPart editPart, Injector xtextInjector)
* @param editPart The editPart on which a direct edit has been performed.
* @param xtextInjector The xtextInjector.
- * @param eobjectContextUpdater The IEObjectContextUpdater, to update the currently edited UML model element
- * @param xtextEditorContextUpdater The IXtextEditorContextUpdater, to update the currently select xtext editor
* @param modelReconciler The IXtextEMFReconciler, to update the context UML model with changes textually specified in the popup xtext editor
* @param textToEdit the initialization text, used as the initial textual content for the popup xtext editor
* @param fileExtension the extension for the temporary textual file (underlying the editor)
- *
+ * @param semanticValidator the semantic validator used to semantically validate the xtext model before saving
*/
public PopupXtextEditorHelper(IGraphicalEditPart editPart,
Injector xtextInjector,
IXtextEMFReconciler modelReconciler,
String textToEdit,
- String fileExtension) {
+ String fileExtension,
+ IXTextSemanticValidator semanticValidator) {
this.hostEditPart = editPart;
this.xtextInjector = xtextInjector ;
this.textToEdit = "" + textToEdit ;
this.modelReconciler = modelReconciler ;
this.fileExtension = "" + fileExtension ;
+ this.semanticValidator = semanticValidator ;
+ this.ignoreFocusLost = false ;
}
/**
* This element was originally not documented in the XText / GMF integration example.
*
- * Changes from CEA LIST:
- * - Statements added for the creation of a temporary text file, used as an input for the popup xtext editor
*/
public void showEditor() {
try {
@@ -187,13 +201,12 @@ public class PopupXtextEditorHelper implements IPopupEditorHelper {
*
* Changes performed by CEA LIST:
* - new statements for managing the reconciliation between the original UML model and
- * the textual specification resulting from the edition in the popup xtext editor. The
- * temporary text file created by showEditor is also deleted.
+ * the textual specification resulting from the edition in the popup xtext editor.
* @param isReconcile Determines whether a reconciliation must be performed or not
*/
public void closeEditor(boolean isReconcile) {
if (sourceViewerHandle != null) {
- if (isReconcile) {
+ if (isReconcile && this.semanticValidator.validate()) {
try {
final IXtextDocument xtextDocument = sourceViewerHandle.getDocument();
if (!isDocumentHasErrors(xtextDocument)) {
@@ -255,7 +268,12 @@ public class PopupXtextEditorHelper implements IPopupEditorHelper {
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
context = semanticElement ;
- closeEditor(true) ;
+ if (! keyListener.isContentAssistActive()) {
+ if (!ignoreFocusLost)
+ closeEditor(true) ;
+ else
+ closeEditor(false) ;
+ }
}
public void focusGained(FocusEvent e) {
@@ -284,44 +302,6 @@ public class PopupXtextEditorHelper implements IPopupEditorHelper {
xtextTextWidget.addKeyListener(keyListener);
}
-// /**
-// * This element was originally not documented in the XText/GMF integration example
-// */
-// private void setEditorRegion() throws BadLocationException {
-// final IXtextDocument xtextDocument = sourceViewer.getDocument();
-// boolean success = sourceViewer.getDocument().modify(new IUnitOfWork<Boolean, XtextResource>() {
-//
-// public Boolean exec(XtextResource state) throws Exception {
-// EObject semanticElementInDocument = state.getEObject(semanticElementFragment);
-//
-// if (semanticElementInDocument == null) {
-// return false;
-// }
-//
-// CompositeNode xtextNode = getCompositeNode(semanticElementInDocument);
-// if (xtextNode == null) {
-// return false;
-// }
-//
-// editorOffset = xtextNode.getOffset();
-// initialEditorSize = xtextNode.getLength() ;
-// initialDocumentSize = xtextDocument.getLength();
-//
-// //xtextDocument.replace(editorOffset + 1 + initialEditorSize, 0, "\n");
-// xtextDocument.replace(editorOffset + initialEditorSize, 0, "\n");
-//
-// return true;
-// }
-//
-// });
-//
-//// if (success) {
-//// xtextEditor.showHighlightRangeOnly(true);
-//// xtextEditor.setHighlightRange(editorOffset + 1, initialEditorSize, true);
-//// xtextEditor.setFocus();
-//// }
-// }
-
/**
* This element was originally not documented in the XText/GMF integration example
*
diff --git a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java
index 4123aa99000..bc0d8f57007 100644
--- a/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java
+++ b/plugins/core/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/edit/part/PopupXtextEditorKeyListener.java
@@ -7,13 +7,19 @@
*******************************************************************************/
package org.eclipse.xtext.gmf.glue.edit.part;
+import java.lang.reflect.Field;
+
+import org.eclipse.jface.text.contentassist.ContentAssistEvent;
import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.ICompletionListener;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.xtext.gmf.glue.partialEditing.SourceViewerHandle;
/**
* @author koehnlein
@@ -33,9 +39,9 @@ public class PopupXtextEditorKeyListener extends KeyAdapter implements VerifyKey
*/
public PopupXtextEditorKeyListener(PopupXtextEditorHelper popupXtextEditorHelper, IContentAssistant contentAssistant) {
this.popupXtextEditorHelper = popupXtextEditorHelper;
- this.contentAssistant = contentAssistant instanceof ContentAssistant ? (ContentAssistant) contentAssistant
- : null;
+ this.contentAssistant = contentAssistant instanceof ContentAssistant ? (ContentAssistant) contentAssistant : null;
isIgnoreNextESC = false;
+
}
@Override
@@ -48,12 +54,31 @@ public class PopupXtextEditorKeyListener extends KeyAdapter implements VerifyKey
if (isIgnoreNextESC) {
isIgnoreNextESC = false;
} else {
+ PopupXtextEditorHelper.ignoreFocusLost = true ;
this.popupXtextEditorHelper.closeEditor(false);
}
}
if ((e.stateMask & SWT.CTRL) != 0 && (keyCode == ' ')) {
+ this.contentAssistant.setRepeatedInvocationMode(true) ;
this.contentAssistant.showPossibleCompletions() ;
this.isIgnoreNextESC = true ;
+ contentAssistant.addCompletionListener(new ICompletionListener() {
+
+ public void selectionChanged(ICompletionProposal proposal, boolean smartToggle) {
+ }
+
+ public void assistSessionStarted(ContentAssistEvent event) {
+ }
+
+ public void assistSessionEnded(ContentAssistEvent event) {
+ try {
+ popupXtextEditorHelper.getSourceViewerHandle().getViewer().getTextWidget().setFocus() ;
+ }
+ catch (Exception e) {
+ //ignore
+ }
+ }
+ }) ;
}
}
@@ -66,7 +91,11 @@ public class PopupXtextEditorKeyListener extends KeyAdapter implements VerifyKey
}
}
- private boolean isContentAssistActive() {
+ /**
+ * @return true if the proposal popup has focus
+ *
+ */
+ public boolean isContentAssistActive() {
return contentAssistant != null && contentAssistant.hasProposalPopupFocus();
}

Back to the top