Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/Activator.java4
-rw-r--r--extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/handlers/ExportProfilesCommand.java5
-rw-r--r--extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/util/AreThereAppliedProfilesFromWS.java14
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF1
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java31
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java (renamed from plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java)2
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java (renamed from plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java)2
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java (renamed from plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java)2
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java25
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java42
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java2
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF3
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java6
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java74
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java21
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java11
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java457
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java49
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java42
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java53
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java36
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java206
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java82
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java59
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java91
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java9
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif (renamed from plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif)bin115 -> 115 bytes
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java39
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java34
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java107
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java)14
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java)26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java24
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java163
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java25
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java124
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java11
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java76
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF1
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java13
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java69
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java34
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java11
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java9
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java17
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java11
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java21
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java34
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java40
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java14
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java4
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java5
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java14
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java2
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java3
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF3
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java66
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF3
-rw-r--r--plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/handler/AbstractCommandHandler.java3
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java1798
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java86
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java2
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml129
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java64
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java2
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java20
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java13
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java97
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java13
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java23
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java33
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java31
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java73
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java15
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java18
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java27
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java67
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java4
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java55
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java2
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java19
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java9
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF3
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java65
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF4
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml10
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java57
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java9
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProvider.java164
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java86
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java10
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java97
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java38
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java16
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/schema/labelprovider.exsd2
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java4
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/providers/SelectionLabelProvider.java4
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/xwt/XWTTabDescriptorProvider.java64
-rw-r--r--sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/Activator.java11
-rw-r--r--sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/aspect/CSSStylePostAction.java21
-rw-r--r--sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/provider/CSSStyleAspectActionProvider.java19
-rw-r--r--tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/src/org/eclipse/papyrus/infra/services/labelprovider/tests/providers/EMFLabelProviderTest.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch10
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java243
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestProfileApplication.java7
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestStereotypeApplication.java4
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java385
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java190
176 files changed, 3392 insertions, 3526 deletions
diff --git a/extraplugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF b/extraplugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
index c42256b0888..b5871a18e45 100644
--- a/extraplugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
+++ b/extraplugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.papyrus.views.modelexplorer;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.uml.tools;bundle-version="0.10.0"
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/Activator.java b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/Activator.java
index e119ac45ba9..c5b0f77b78b 100644
--- a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/Activator.java
+++ b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/Activator.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.uml.export;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -31,6 +32,8 @@ public class Activator extends AbstractUIPlugin {
/** The plugin. */
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor.
*/
@@ -56,6 +59,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/handlers/ExportProfilesCommand.java b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/handlers/ExportProfilesCommand.java
index 811e1296ad0..b3bdf017afb 100644
--- a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/handlers/ExportProfilesCommand.java
+++ b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/handlers/ExportProfilesCommand.java
@@ -14,7 +14,6 @@
package org.eclipse.papyrus.uml.export.handlers;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -49,8 +48,6 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.widgets.util.FileUtil;
-
-import org.eclipse.papyrus.uml.export.dialog.ExportProfilesIconsDialog;
import org.eclipse.papyrus.uml.export.dialog.ExportProfilesParametersDialog;
import org.eclipse.papyrus.uml.export.dialog.ProfilesToExportSelectionDialog;
import org.eclipse.papyrus.uml.export.messages.Messages;
@@ -146,7 +143,7 @@ public class ExportProfilesCommand extends AbstractTransactionalCommand {
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
UmlModel openedModel;
try {
diff --git a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/util/AreThereAppliedProfilesFromWS.java b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/util/AreThereAppliedProfilesFromWS.java
index 1705cd006bc..8e76f40ad1e 100644
--- a/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/util/AreThereAppliedProfilesFromWS.java
+++ b/extraplugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/util/AreThereAppliedProfilesFromWS.java
@@ -18,7 +18,9 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.uml.export.Activator;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -57,10 +59,10 @@ public class AreThereAppliedProfilesFromWS extends PropertyTester {
Object currentValue = null;
if(ARE_THERE_APPLIED_PROFILES.equals(property)) {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServicesRegistry registry = ((IMultiDiagramEditor)editor).getServicesRegistry();
UmlModel openedModel;
try {
- openedModel = (UmlModel)serviceUtils.getModelSet().getModel(UmlModel.MODEL_ID);
+ openedModel = (UmlModel)ServiceUtils.getInstance().getModelSet(registry).getModel(UmlModel.MODEL_ID);
EObject root = openedModel.lookupRoot();
Object[] profiles = ProfileUtil.getAppliedProfilesFromWS(root);
@@ -72,11 +74,9 @@ public class AreThereAppliedProfilesFromWS extends PropertyTester {
}
return (currentValue == expectedValue);
} catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ Activator.log.error(e);
} catch (NotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ Activator.log.error(e);
}
}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
index 9ca9e56279f..23a9e316165 100644
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
@@ -8,7 +8,6 @@ Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java
new file mode 100644
index 00000000000..e99f7ab2779
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.services.labelprovider.service;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * A LabelProvider which may use a context element to compute its labels.
+ * It can be used to compute e.g. relative paths from a base namespace
+ *
+ * @author Camille Letavernier
+ */
+public interface ContextualLabelProvider extends ILabelProvider {
+
+ /**
+ * Sets the context element against which the labels will be computed
+ *
+ * @param contextElement
+ * the context element against which the labels will be computed (e.g. base namespace for relative paths)
+ */
+ public void setContext(Object contextElement);
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
index 0180c47d610..2412359ab9b 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/ExtensibleLabelProvider.java
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.providers;
+package org.eclipse.papyrus.infra.services.labelprovider.service;
import java.util.LinkedHashSet;
import java.util.LinkedList;
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java
index 90a39fa6d3a..f76e7743239 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IDetailLabelProvider.java
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.providers;
+package org.eclipse.papyrus.infra.services.labelprovider.service;
import org.eclipse.jface.viewers.ILabelProvider;
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java
index 1d7dfb56763..d0f015c1f2d 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/IFilteredLabelProvider.java
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.providers;
+package org.eclipse.papyrus.infra.services.labelprovider.service;
import org.eclipse.jface.viewers.ILabelProvider;
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
index e7f0240ae11..a0657f0cbce 100644
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
@@ -57,4 +57,29 @@ public interface LabelProviderService extends IService {
*/
public ILabelProvider getLabelProvider(String context);
+ /**
+ * Retrieves the LabelProvider for the given context. The provider will return
+ * labels based on the contextElement
+ *
+ * @param context
+ * The context in which the ILabelProvider will be used. According to the context,
+ * a different implementation may be returned. If the context is unknown or null,
+ * the standard ILabelProvider will be returned
+ * @param contextElement
+ * The element against which the labels should be computed. It can for example
+ * be the base namespace to compute relative labels.
+ * @return
+ */
+ public ILabelProvider getLabelProvider(String context, Object contextElement);
+
+ /**
+ * Retrieves the default LabelProvider. The provider will return
+ * labels based on the contextElement
+ *
+ * @param contextElement
+ * The element against which the labels should be computed. It can for example
+ * be the base namespace to compute relative labels.
+ */
+ public ILabelProvider getLabelProvider(Object contextElement);
+
}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
index 062029c33da..2a069b13a04 100644
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
@@ -20,9 +20,10 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.services.labelprovider.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.ContextualLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.ExtensibleLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.papyrus.infra.widgets.providers.ExtensibleLabelProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
/**
* Default implementation for the LabelProviderService
@@ -56,6 +57,12 @@ public class LabelProviderServiceImpl implements LabelProviderService {
readLabelProviders(config);
}
+ /**
+ * Parses the available contexts from the extension point
+ *
+ * @param config
+ * The extension point IConfigurationElements
+ */
private void readContexts(IConfigurationElement[] config) {
for(IConfigurationElement e : config) {
try {
@@ -87,6 +94,12 @@ public class LabelProviderServiceImpl implements LabelProviderService {
}
}
+ /**
+ * Parses the available label providers from the extension point
+ *
+ * @param config
+ * The extension point IConfigurationElements
+ */
private void readLabelProviders(IConfigurationElement[] config) {
for(IConfigurationElement e : config) {
try {
@@ -163,6 +176,9 @@ public class LabelProviderServiceImpl implements LabelProviderService {
return labelProviders.get(context);
}
+ /**
+ * {@inheritDoc}
+ */
private class SharedExtensibleLabelProvider extends ExtensibleLabelProvider {
@Override
@@ -177,4 +193,26 @@ public class LabelProviderServiceImpl implements LabelProviderService {
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public ILabelProvider getLabelProvider(String context, Object contextElement) {
+ ILabelProvider provider = getLabelProvider(context);
+ if(provider instanceof ContextualLabelProvider) {
+ ((ContextualLabelProvider)provider).setContext(contextElement);
+ }
+ return provider;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ILabelProvider getLabelProvider(Object contextElement) {
+ ILabelProvider provider = getLabelProvider();
+ if(provider instanceof ContextualLabelProvider) {
+ ((ContextualLabelProvider)provider).setContext(contextElement);
+ }
+ return provider;
+ }
+
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
index 7cc69342450..f2b996b9b79 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
@@ -32,13 +32,13 @@ import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.constraints.providers.ConstraintTypeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.contexts.ContextsPackage;
diff --git a/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
index face8883771..5a723911692 100644
--- a/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
+++ b/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
@@ -4,7 +4,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.ui.ide;bundle-version="3.8.0"
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.editor
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java
index 5e2d2ec474e..8aae9b1f975 100644
--- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.editor;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -14,6 +15,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -25,9 +28,11 @@ public class Activator extends AbstractUIPlugin {
*
* @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(this);
}
/*
@@ -35,6 +40,7 @@ public class Activator extends AbstractUIPlugin {
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java
index 5061c4fb806..455a7d7ef04 100644
--- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java
@@ -6,13 +6,17 @@ package org.eclipse.papyrus.editor.commands;
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.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.editor.Activator;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
@@ -43,28 +47,28 @@ public class RenameNestedEditorCommand extends AbstractHandler {
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
-// try {
-// IEditorPart part = HandlerUtil.getActiveEditor(event);
-// IPageMngr pageMngr = (IPageMngr)part.getAdapter(IPageMngr.class);
-// ISashWindowsContainer container = (ISashWindowsContainer)part.getAdapter(ISashWindowsContainer.class);
-// IPage sashPage = container.getActiveSashWindowsPage();
-//
-// if(sashPage instanceof IEditorPage )
-// {
-// IEditorPage editorPage = (IEditorPage)sashPage;
-// execute(editorPage.getRawModel(), editorPage.getIEditorPart());
-// }
-// // Bug from sash Di to be corrected
-// if(pageIdentifier instanceof PageRef)
-// {
-// pageIdentifier = ((PageRef)pageIdentifier).getPageIdentifier();
-// }
-// execute(sashPage.getRawModel(), sashPage.);
-//
-// } catch (NullPointerException e) {
-// // PageMngr can't be found
-// return null;
-// }
+ // try {
+ // IEditorPart part = HandlerUtil.getActiveEditor(event);
+ // IPageMngr pageMngr = (IPageMngr)part.getAdapter(IPageMngr.class);
+ // ISashWindowsContainer container = (ISashWindowsContainer)part.getAdapter(ISashWindowsContainer.class);
+ // IPage sashPage = container.getActiveSashWindowsPage();
+ //
+ // if(sashPage instanceof IEditorPage )
+ // {
+ // IEditorPage editorPage = (IEditorPage)sashPage;
+ // execute(editorPage.getRawModel(), editorPage.getIEditorPart());
+ // }
+ // // Bug from sash Di to be corrected
+ // if(pageIdentifier instanceof PageRef)
+ // {
+ // pageIdentifier = ((PageRef)pageIdentifier).getPageIdentifier();
+ // }
+ // execute(sashPage.getRawModel(), sashPage.);
+ //
+ // } catch (NullPointerException e) {
+ // // PageMngr can't be found
+ // return null;
+ // }
@@ -77,10 +81,23 @@ public class RenameNestedEditorCommand extends AbstractHandler {
* @param pageMngr
*/
public void execute(final Diagram diagram, final IEditorPart editorPart) {
+ TransactionalEditingDomain editingDomain = null;
+
+ if(editorPart instanceof IAdaptable) {
+ ServicesRegistry registry = (ServicesRegistry)((IAdaptable)editorPart).getAdapter(ServicesRegistry.class);
+
+ if(registry == null) {
+ editingDomain = (TransactionalEditingDomain)((IAdaptable)editorPart).getAdapter(TransactionalEditingDomain.class);
+ } else {
+ try {
+ editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
-
-
- TransactionalEditingDomain editingDomain = EditorUtils.getTransactionalEditingDomain();
if(editingDomain != null) {
InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename an existing diagram", "New name:", diagram.getName(), null);
if(dialog.open() == Window.OK) {
@@ -89,7 +106,7 @@ public class RenameNestedEditorCommand extends AbstractHandler {
Command command = new RecordingCommand(editingDomain) {
-
+
@Override
protected void doExecute() {
diagram.setName(name);
@@ -102,5 +119,4 @@ public class RenameNestedEditorCommand extends AbstractHandler {
}
}
- }
-
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
index 047e701810a..d14d4f739a8 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
@@ -10,8 +10,7 @@ Require-Bundle: org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
org.eclipse.gef;bundle-version="3.8.1",
org.eclipse.emf.ecore.xmi;bundle-version="2.8.0",
- org.eclipse.emf.workspace;bundle-version="1.5.1",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0"
+ org.eclipse.emf.workspace;bundle-version="1.5.1"
Export-Package: org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.infra.core.contentoutline,
org.eclipse.papyrus.infra.core.editor,
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
index 367ec8ab1f3..e1ef11dea66 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
@@ -363,7 +363,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
}
- if(EditingDomain.class == adapter) {
+ if(EditingDomain.class == adapter || TransactionalEditingDomain.class == adapter) {
return transactionalEditingDomain;
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
index 42929809a48..55c60fd9f62 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/lifecycleevents/SaveAndDirtyService.java
@@ -97,7 +97,7 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
/**
* The serviceRegistry.
*/
-// private ServicesRegistry servicesRegistry;
+ // private ServicesRegistry servicesRegistry;
/**
* Associated editor. Needed by saveAs to synchronize editor input.
@@ -179,7 +179,7 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
*/
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
-// this.servicesRegistry = servicesRegistry;
+ // this.servicesRegistry = servicesRegistry;
// Retrieve required services.
resourceSet = servicesRegistry.getService(ModelSet.class);
@@ -222,27 +222,27 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
// Check if commandStack is null (meaning that transactionalEditingDomain
// is disposed
CommandStack commandStack = transactionalEditingDomain.getCommandStack();
- if( commandStack != null) {
+ if(commandStack != null) {
transactionalEditingDomain.getCommandStack().removeCommandStackListener(commandStackListener);
}
transactionalEditingDomain.removeResourceSetListener(resourceSetListener);
-// resourceSetListener = null;
+ // resourceSetListener = null;
}
-
+
// clean properties in order to help GC
inputChangedListeners.clear();
inputChangedListeners = null;
multiDiagramEditor = null;
-// servicesRegistry = null;
+ // servicesRegistry = null;
transactionalEditingDomain = null;
resourceSet = null;
lifeCycleEvent = null;
-
+
postSaveListeners.clear();
saveListeners.clear();
preSaveListeners.clear();
-
-
+
+
}
/**
@@ -474,8 +474,9 @@ public class SaveAndDirtyService extends LifeCycleEventsProvider implements ISav
*/
public boolean isDirty() {
for(ISaveablePart part : this) {
- if(part.isDirty())
+ if(part.isDirty()) {
return true;
+ }
}
return false;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
index 44c43a293e4..fb4e543237a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/DisplayUtils.java
@@ -11,15 +11,18 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
-import static org.eclipse.papyrus.infra.core.Activator.log;
-
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+
/**
* Util class for display in Papyrus (label providers, etc...)
+ *
+ * @deprecated Use the LabelProviderService instead
*/
+@Deprecated
public class DisplayUtils {
/**
@@ -34,9 +37,9 @@ public class DisplayUtils {
return registry == null ? null : registry.getService(ILabelProvider.class);
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
- log.error(e);
+ Activator.log.error(e);
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
index 5ad815c0e37..f3ea7a7bcfd 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EditorUtils.java
@@ -15,14 +15,13 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
-import static org.eclipse.papyrus.infra.core.Activator.log;
-
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
@@ -59,70 +58,6 @@ import org.eclipse.ui.PlatformUI;
public class EditorUtils {
/**
- * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
- * editor, if possible, or null if not possible. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc. <br>
- * This method return null if there is no active editor, or if the editor is
- * not instance of IMultiDiagramEditor. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. Usage of this method is discouraged. Use {@link #getMultiDiagramEditorChecked()} instead.
- *
- *
- * @return Get the current {@link IMultiDiagramEditor} or null if not found.
- */
- public static IMultiDiagramEditor getMultiDiagramEditor() {
- // Lookup ServiceRegistry
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if(workbenchWindow == null) {
- return null;
- }
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if(page == null) {
- return null;
- }
- IEditorPart editor = page.getActiveEditor();
- if(editor instanceof IMultiDiagramEditor) {
- return (IMultiDiagramEditor)editor;
- } else {
- return null;
- }
- }
-
- /**
- * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
- * editor, if possible, or throw an exception if not possible. <br>
- * WARNING - This method throw an exception during the initialization of the
- * main editor. This method throws an exception if there is no active
- * editor, or if the editor is not instance of IMultiDiagramEditor. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- *
- *
- * @return Get the current {@link IMultiDiagramEditor} or null if not found.
- * @throws BackboneException
- * If it is not possible to get an instanceof {@link IMultiDiagramEditor}
- */
- public static IMultiDiagramEditor getMultiDiagramEditorChecked() throws BackboneException {
- IEditorPart editor;
- try {
- editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- } catch (NullPointerException e) {
- // Can't get the active editor
- throw new BackboneException("Can't get the current Eclipse Active Editor: There is no active editor at this time.");
- }
-
- if(editor instanceof IMultiDiagramEditor) {
- return (IMultiDiagramEditor)editor;
- } else {
- throw new BackboneException("Can't get an Active Editor instance of IMultiDiagramEditor. (actual type:" + editor.getClass().getName() + ")");
- }
- }
-
- /**
* Gets the opened multi-diagram editors.
*
* @return The opened {@link IMultiDiagramEditor} or null if an error
@@ -177,187 +112,72 @@ public class EditorUtils {
}
/**
- * Get the {@link ServicesRegistry}of the currently active eclipse editor. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc. <br>
- * This method return null if the ServicesRegistry can not be found. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. An alternative is to use {@link #getServiceRegistryChecked()} and
- * to catch the exception. <br>
- * It is preferable to retrieve the ServiceRegistry from elsewhere whenever
- * it is possible. <br>
- * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved
- * with methods from
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
- *
- * <br>
- * WARNING: This method can return null if there is no Active Editor. This
- * happen during the editor initialization, especially when there is no
- * other editor opened.
+ * Create an instance of IPageMngr acting on the provided resource. This
+ * instance is suitable to add, remove, close or open diagrams.
*
- * @return The {@link ServicesRegistry} or null if not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ * @param diResource
+ * @return The non transactional implementation of IPageMngr
*/
- @Deprecated
- static public ServicesRegistry getServiceRegistry() {
- // Lookup ServiceRegistry
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- return editor == null ? null : (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ public static IPageMngr getIPageMngr(Resource diResource) {
+ return DiSashModelMngr.createIPageMngr(diResource);
}
/**
- * Get the service registry of the currently active main editor. <br>
- * WARNING - This method doesn't work during the initialization of the main
- * editor. See note in class doc.
+ * Create an instance of IPageMngr acting on the provided resource. This
+ * instance is suitable to add, remove, close or open diagrams.
*
- * @return The {@link ServicesRegistry} or null if not found.
- * @throws ServiceException
- * If an error occurs.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ * @param diResource
+ * @param editingDomain
+ *
+ * @return The transactional implementation of IPageMngr
*/
- @Deprecated
- static public ServicesRegistry getServiceRegistryChecked() throws ServiceException {
- // Lookup ServiceRegistry
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- if(editor == null) {
- throw new ServiceException("Can't get ServiceRegistry");
- }
-
- return (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ public static IPageMngr getTransactionalIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
+ return TransactionalDiSashModelMngr.createIPageMngr(diResource, editingDomain);
}
- /**
- * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
- * possible. <br>
- * This method return null if the ServiceRegistry can not be found or if an
- * error occur. <br>
- * This method is designed to be used by ui actions that interact with the
- * active editor. <br>
- * This method should not be used during the editor initialization phase. <br>
- * In any case, a check should be done on the returned value that can be
- * null. <br>
- *
- * @return the ISashWindowsContentProvider from the main editor or null if
- * not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
- */
- @Deprecated
- static public ISashWindowsContentProvider getISashWindowsContentProvider() {
- try {
- return getServiceRegistryChecked().getService(ISashWindowsContentProvider.class);
- } catch (ServiceException e) {
- // The contract says that we return null if not found
- return null;
- }
- }
+ ////////////////////////////////////////////
+ // The following methods are deprecated. They have been replaced by specific
+ // implementations of ServiceUtils (e.g. ServiceUtilsForHandlers, ServiceUtilsForEObject),
+ // which depend on a specific context (ExecutionEvent, EObject, ...) instead of
+ // the active editor
+ ////////////////////////////////////////////
/**
- * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
- * possible. <br>
- * This method return null if the ServiceRegistry can not be found or if an
- * error occur. <br>
+ * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
+ * editor, if possible, or null if not possible. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc. <br>
+ * This method return null if there is no active editor, or if the editor is
+ * not instance of IMultiDiagramEditor. <br>
* This method is designed to be used by ui actions that interact with the
* active editor. <br>
* This method should not be used during the editor initialization phase. <br>
* In any case, a check should be done on the returned value that can be
- * null.
+ * null. Usage of this method is discouraged. Use {@link #getMultiDiagramEditorChecked()} instead.
*
- * @return the ISashWindowsContentProvider from the main editor or null if
- * not found.
- * @deprecated Check
- * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
- * /cookbook/PapyrusCookBook.odt and use one of the replacement:
- * <ul>
- * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
- * <li>
- * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
- * <li>
- * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
- * </ul>
+ *
+ * @return Get the current {@link IMultiDiagramEditor} or null if not found.
*/
- @Deprecated
- public static IPageMngr getIPageMngr() {
-
- try {
- return getServiceRegistryChecked().getService(IPageMngr.class);
- } catch (ServiceException e) {
- // The contract says that we return null if not found
+ public static IMultiDiagramEditor getMultiDiagramEditor() {
+ // Lookup ServiceRegistry
+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if(workbenchWindow == null) {
return null;
}
- }
-
- /**
- * Get the Eclipse ActiveEditor.
- *
- * @return The active {@link CoreMultiDiagramEditor} or null if not found.
- * @deprecated Use {@link EditorUtils#getMultiDiagramEditor()}
- */
- @Deprecated
- protected static IEditorPart getWorkbenchActiveEditor() {
- IMultiDiagramEditor editorPart = getMultiDiagramEditor();
- if(editorPart instanceof CoreMultiDiagramEditor) {
- return editorPart;
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ if(page == null) {
+ return null;
+ }
+ IEditorPart editor = page.getActiveEditor();
+ if(editor instanceof IMultiDiagramEditor) {
+ return (IMultiDiagramEditor)editor;
} else {
return null;
}
}
/**
- * Create an instance of IPageMngr acting on the provided resource. This
- * instance is suitable to add, remove, close or open diagrams.
- *
- * @param diResource
- * @return The non transactional implementation of IPageMngr
- */
- public static IPageMngr getIPageMngr(Resource diResource) {
- return DiSashModelMngr.createIPageMngr(diResource);
- }
-
- /**
- * Create an instance of IPageMngr acting on the provided resource. This
- * instance is suitable to add, remove, close or open diagrams.
- *
- * @param diResource
- * @param editingDomain
- *
- * @return The transactional implementation of IPageMngr
- */
- public static IPageMngr getTransactionalIPageMngr(Resource diResource, TransactionalEditingDomain editingDomain) {
- return TransactionalDiSashModelMngr.createIPageMngr(diResource, editingDomain);
- }
-
- /**
* Lookup the currently active Diagram from the Papyrus editor. Return the
* current Diagram or null if none is active. <br>
* WARNING - This method doesn't work during the initialization of the main
@@ -372,6 +192,7 @@ public class EditorUtils {
* Editors, GMF stuff should be moved in GMF projects. In many
* case, {@link #lookupActiveNestedIEditor()} can be used.
*/
+ // @Deprecated
// public static Diagram lookupEditorActiveDiagram() {
// DiagramEditor diagEditor = lookupActiveDiagramEditor();
// return diagEditor == null ? null : diagEditor.getDiagram();
@@ -392,6 +213,7 @@ public class EditorUtils {
* Editors, GMF stuff should be moved in GMF projects. In many
* case, {@link #lookupActiveNestedIEditor()} can be used.
*/
+ // @Deprecated
// public static DiagramEditor lookupActiveDiagramEditor() {
// // Get the active page within the sashcontainer
// IEditorPart activeEditor = lookupActiveNestedIEditor();
@@ -516,7 +338,7 @@ public class EditorUtils {
ServicesRegistry registry = getServiceRegistry();
return registry == null ? null : registry.getService(DiResourceSet.class);
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -563,7 +385,7 @@ public class EditorUtils {
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -633,7 +455,7 @@ public class EditorUtils {
} catch (IllegalStateException e) {
// Registry can't be found, do nothing.
} catch (ServiceException e) {
- log.error(e);
+ Activator.log.error(e);
}
return null;
}
@@ -657,4 +479,191 @@ public class EditorUtils {
return registry.getService(TransactionalEditingDomain.class);
}
+ /**
+ * Get the {@link ServicesRegistry}of the currently active eclipse editor. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc. <br>
+ * This method return null if the ServicesRegistry can not be found. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null. An alternative is to use {@link #getServiceRegistryChecked()} and
+ * to catch the exception. <br>
+ * It is preferable to retrieve the ServiceRegistry from elsewhere whenever
+ * it is possible. <br>
+ * In GMF EditParts or EditPolicies, the ServiceRegistry can be retrieved
+ * with methods from
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF
+ *
+ * <br>
+ * WARNING: This method can return null if there is no Active Editor. This
+ * happen during the editor initialization, especially when there is no
+ * other editor opened.
+ *
+ * @return The {@link ServicesRegistry} or null if not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ServicesRegistry getServiceRegistry() {
+ // Lookup ServiceRegistry
+ IMultiDiagramEditor editor = getMultiDiagramEditor();
+ return editor == null ? null : (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ }
+
+ /**
+ * Get the service registry of the currently active main editor. <br>
+ * WARNING - This method doesn't work during the initialization of the main
+ * editor. See note in class doc.
+ *
+ * @return The {@link ServicesRegistry} or null if not found.
+ * @throws ServiceException
+ * If an error occurs.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ServicesRegistry getServiceRegistryChecked() throws ServiceException {
+ // Lookup ServiceRegistry
+ IMultiDiagramEditor editor = getMultiDiagramEditor();
+ if(editor == null) {
+ throw new ServiceException("Can't get ServiceRegistry");
+ }
+
+ return (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
+ }
+
+ /**
+ * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
+ * possible. <br>
+ * This method return null if the ServiceRegistry can not be found or if an
+ * error occur. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null. <br>
+ *
+ * @return the ISashWindowsContentProvider from the main editor or null if
+ * not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ static public ISashWindowsContentProvider getISashWindowsContentProvider() {
+
+ try {
+ return getServiceRegistryChecked().getService(ISashWindowsContentProvider.class);
+ } catch (ServiceException e) {
+ // The contract says that we return null if not found
+ return null;
+ }
+ }
+
+ /**
+ * Get the ISashWindowsContentProvider of the active Eclipse Editor, if
+ * possible. <br>
+ * This method return null if the ServiceRegistry can not be found or if an
+ * error occur. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ * This method should not be used during the editor initialization phase. <br>
+ * In any case, a check should be done on the returned value that can be
+ * null.
+ *
+ * @return the ISashWindowsContentProvider from the main editor or null if
+ * not found.
+ * @deprecated Check
+ * modeling/org.eclipse.mdt.papyrus/trunk/doc/DevelopperDocuments
+ * /cookbook/PapyrusCookBook.odt and use one of the replacement:
+ * <ul>
+ * <li>org.eclipse.papyrus.infra.core.utils.ServiceUtils</li>
+ * <li>
+ * org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF</li>
+ * <li>
+ * org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers (to be used with care !)</li>
+ * </ul>
+ */
+ @Deprecated
+ public static IPageMngr getIPageMngr() {
+
+ try {
+ return getServiceRegistryChecked().getService(IPageMngr.class);
+ } catch (ServiceException e) {
+ // The contract says that we return null if not found
+ return null;
+ }
+ }
+
+ /**
+ * Get the Eclipse ActiveEditor.
+ *
+ * @return The active {@link CoreMultiDiagramEditor} or null if not found.
+ * @deprecated Use {@link EditorUtils#getMultiDiagramEditor()}
+ */
+ @Deprecated
+ protected static IEditorPart getWorkbenchActiveEditor() {
+ IMultiDiagramEditor editorPart = getMultiDiagramEditor();
+ if(editorPart instanceof CoreMultiDiagramEditor) {
+ return editorPart;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the {@link IMultiDiagramEditor} interface of the a Eclipse active
+ * editor, if possible, or throw an exception if not possible. <br>
+ * WARNING - This method throw an exception during the initialization of the
+ * main editor. This method throws an exception if there is no active
+ * editor, or if the editor is not instance of IMultiDiagramEditor. <br>
+ * This method is designed to be used by ui actions that interact with the
+ * active editor. <br>
+ *
+ *
+ * @return Get the current {@link IMultiDiagramEditor} or null if not found.
+ * @throws BackboneException
+ * If it is not possible to get an instanceof {@link IMultiDiagramEditor}
+ */
+ public static IMultiDiagramEditor getMultiDiagramEditorChecked() throws BackboneException {
+ IEditorPart editor;
+ try {
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ } catch (NullPointerException e) {
+ // Can't get the active editor
+ throw new BackboneException("Can't get the current Eclipse Active Editor: There is no active editor at this time.");
+ }
+
+ if(editor instanceof IMultiDiagramEditor) {
+ return (IMultiDiagramEditor)editor;
+ } else {
+ throw new BackboneException("Can't get an Active Editor instance of IMultiDiagramEditor. (actual type:" + editor.getClass().getName() + ")");
+ }
+ }
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
index ed13e4a2bf1..be502649376 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForActionHandlers.java
@@ -36,9 +36,15 @@ import org.eclipse.ui.PlatformUI;
*
* @author cedric dumoulin
*
+ * @deprecated 0.10: Use org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers instead
*/
+@Deprecated
public class ServiceUtilsForActionHandlers {
+ private ServiceUtilsForActionHandlers() {
+ //Singleton
+ }
+
private final static ServiceUtilsForActionHandlers instance = new ServiceUtilsForActionHandlers();
/**
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java
new file mode 100644
index 00000000000..c876d517f32
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/ServiceUtilsForWorkbenchPage.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.core.utils;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * A ServiceUtils implementation for manipulating the Papyrus services from an IWorkbenchPage
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ServiceUtilsForWorkbenchPage extends AbstractServiceUtils<IWorkbenchPage> {
+
+ @Override
+ public ServicesRegistry getServiceRegistry(IWorkbenchPage from) throws ServiceException {
+ if(from instanceof IAdaptable) {
+ ServicesRegistry registry = (ServicesRegistry)((IAdaptable)from).getAdapter(ServicesRegistry.class);
+ if(registry != null) {
+ return registry;
+ }
+ }
+
+ throw new ServiceException("Cannot resolve the ServiceRegistry from the IWorkbenchPage");
+ }
+
+ public static ServiceUtilsForWorkbenchPage getInstance() {
+ return instance;
+ }
+
+ private static ServiceUtilsForWorkbenchPage instance = new ServiceUtilsForWorkbenchPage();
+
+ private ServiceUtilsForWorkbenchPage() {
+ //Singleton
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
index cd3a8848ef5..c46f9003133 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/META-INF/MANIFEST.MF
@@ -5,7 +5,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
org.eclipse.core.commands;bundle-version="3.6.1",
org.eclipse.ui,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.emf.diagram.common,
org.eclipse.papyrus.infra.emf.diagram.common.handler
Bundle-Vendor: %providerName
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
index ccd6c04cbc2..13aa1f4e3ce 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/Activator.java
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.diagram.common;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -27,6 +28,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -42,6 +45,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
index 215a8de4887..ced77247413 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
@@ -22,7 +22,12 @@ import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
/**
@@ -43,14 +48,25 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
* @return
* @throws ExecutionException
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+ final ServicesRegistry registry;
+
+ TransactionalEditingDomain editingDomain;
+
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
- TransactionalEditingDomain editingDomain = getEditingDomain();
RecordingCommand command = new RecordingCommand(editingDomain, "Create EMF Diagram") {
@Override
protected void doExecute() {
- addNewDiagram();
+ addNewDiagram(registry);
}
};
@@ -62,7 +78,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
/**
* Subclasses should implements this method.
*/
- protected abstract void addNewDiagram();
+ protected abstract void addNewDiagram(ServicesRegistry registry);
/**
* Add a new Diagram to the graphical model.
@@ -71,7 +87,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
* The diagram to add to graphical model. This will be the diagram provided to
* {@link IPluggableEditorFactory#createIPageModel(Object, org.eclipse.papyrus.infra.core.services.ServicesRegistry)}
*/
- protected void addNewDiagram(String name, String type, EObject diagram) {
+ protected void addNewDiagram(String name, String type, EObject diagram, ServicesRegistry registry) {
// TODO Create a special node inside the sash model (di) instead of introducing
// a dependence on notation.
@@ -91,15 +107,11 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH
// Attach to sash in order to show it
// Add the diagram as a page to the current sash folder
- EditorUtils.getISashWindowsContentProvider().addPage(di2Diagram);
+ try {
+ registry.getService(ISashWindowsContentProvider.class).addPage(di2Diagram);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
- /**
- * Get the main editing doamin.
- *
- * @return
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return EditorUtils.getTransactionalEditingDomain();
- }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
index cdf12500169..4cfd540edf1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
@@ -16,7 +16,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.efacet.core;bundle-version="0.2.0",
org.eclipse.emf.facet.custom.core;bundle-version="0.2.0",
org.eclipse.emf.facet.custom.ui;bundle-version="0.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.emf.editor.part,
org.eclipse.papyrus.infra.emf.editor.providers
Bundle-Vendor: Eclipse Modeling Project
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
index 2699370af49..12280dfe151 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/Activator.java
@@ -1,12 +1,7 @@
package org.eclipse.papyrus.infra.emf.editor;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
-import org.eclipse.emf.facet.infra.browser.custom.core.CustomizationsCatalog;
import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -23,6 +18,8 @@ public class Activator extends AbstractUIPlugin {
private CustomizationManager fCustomizationManager;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -38,6 +35,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
@@ -65,28 +63,29 @@ public class Activator extends AbstractUIPlugin {
* @return the customization manager in charge to adapt element in modisco
*/
public CustomizationManager getCustomizationManager() {
- if(this.fCustomizationManager == null) {
- this.fCustomizationManager = new CustomizationManager();
- init(this.fCustomizationManager);
- }
- return this.fCustomizationManager;
+ return org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
+ // if(this.fCustomizationManager == null) {
+ // this.fCustomizationManager = new CustomizationManager();
+ // init(this.fCustomizationManager);
+ // }
+ // return this.fCustomizationManager;
}
- private void init(final CustomizationManager customizationManager) {
- customizationManager.setShowContainer(false);
- customizationManager.setShowDerivedLinks(false);
- customizationManager.setShowEmptyLinks(false);
-
- try {
- List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
- for(MetamodelView metamodelView : registryDefaultCustomizations) {
- customizationManager.registerCustomization(metamodelView);
- }
-
- customizationManager.loadCustomizations();
- } catch (Throwable e) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
- }
- }
+ // private void init(final CustomizationManager customizationManager) {
+ // customizationManager.setShowContainer(false);
+ // customizationManager.setShowDerivedLinks(false);
+ // customizationManager.setShowEmptyLinks(false);
+ //
+ // try {
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ // customizationManager.registerCustomization(metamodelView);
+ // }
+ //
+ // customizationManager.loadCustomizations();
+ // } catch (Throwable e) {
+ // Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ // }
+ // }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
index ac3b8b43ccc..cc4ef76ef56 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
@@ -15,7 +15,6 @@ import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory
import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
-import org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider;
import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
import org.eclipse.emf.transaction.TransactionalCommandStack;
import org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl;
@@ -24,13 +23,18 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.editor.Activator;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoDropAdapter;
import org.eclipse.papyrus.infra.emf.editor.providers.CustomizableContentProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
@@ -73,6 +77,11 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
*/
protected IPropertySheetPage iPropertySheetPage;
+ /**
+ * The services registry associated to this editor
+ */
+ protected ServicesRegistry registry;
+
@Override
public void createPages() {
// Creates the model from the editor input
@@ -91,6 +100,16 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
Composite parent = new Composite(gParent, SWT.NONE);
parent.setLayout(new PropertiesLayout());
+ // try {
+ // registry = new ServicesRegistry();
+ // registry.add(LabelProviderService.class, 1, new LabelProviderServiceImpl());
+ // registry.add(ServiceUtilsForResourceInitializerService.class, 1, new ServiceUtilsForResourceInitializerService());
+ // //registry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ // registry.startRegistry();
+ // } catch (ServiceException ex) {
+ // Activator.log.error(ex);
+ // }
+
// Only creates the other pages if there is something that can be edited
//
if(!getEditingDomain().getResourceSet().getResources().isEmpty()) {
@@ -249,7 +268,20 @@ public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPa
}
protected ILabelProvider createLabelProvider() {
- return new CustomizableModelLabelProvider(getCustomizationManager());
+ LabelProviderService service = new LabelProviderServiceImpl();
+ try {
+ service.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return new LabelProvider();
+ }
+ return service.getLabelProvider();
+ // try {
+ // return registry.getService(LabelProviderService.class).getLabelProvider();
+ // } catch (ServiceException ex) {
+ // Activator.log.error(ex);
+ // return new LabelProvider();
+ // }
}
public void commandStackChanged(EventObject event) {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
index e41d2e0ced8..5bb2bedeede 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
@@ -22,10 +22,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.util.emf.core,
com.ibm.icu;bundle-version="4.4.2",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0"
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400"
Export-Package: org.eclipse.papyrus.infra.emf,
org.eclipse.papyrus.infra.emf.commands,
org.eclipse.papyrus.infra.emf.databinding,
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
index cf05a5ea7c8..b03ffe1f2f2 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
@@ -21,12 +21,12 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
index c65b67a7b70..4b8190009c1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
@@ -15,7 +15,7 @@ import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
/**
* A LabelProvider which only accepts EMF Objects (EObject, or objects which can be adapted to EObjects)
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
index 0186df0b430..1358287b040 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
@@ -37,11 +37,11 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
import org.eclipse.papyrus.infra.widgets.providers.PatternViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
index c3f8d98febc..5092eedd06d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
index b22afa83745..723454b1b4a 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
@@ -53,31 +53,11 @@ public class MoDiscoContentProvider extends CustomizableModelContentProvider {
@Override
public Object[] getChildren(final Object parentElement) {
- ArrayList<Object> result = new ArrayList<Object>();
-
- Object[] arrayObject = super.getChildren(parentElement);
- if(arrayObject != null) {
- for(int i = 0; i < arrayObject.length; i++) {
- result.add(arrayObject[i]);
- }
+ Object[] children = super.getChildren(parentElement);
+ if(children == null) {
+ return new Object[0];
}
- /**
- * Refactoring with bug 358732
- */
- //
- // if (parentElement instanceof IAdaptable) {
- // EObject eObject = (EObject)((IAdaptable)parentElement).getAdapter(EObject.class);
- // if(eObject !=null) {
- // List<Diagram> diagramList = findAllExistingDiagrams(eObject);
- // Iterator<Diagram> iterator = diagramList.iterator();
- // while (iterator.hasNext()) {
- // result.add(iterator.next());
- // }
- // }
- //
- // }
-
- return result.toArray();
+ return children;
}
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
deleted file mode 100644
index 8de88a60d54..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Support for AdaptableContentProvider
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.emf.providers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.facet.infra.browser.uicore.internal.model.BigListItem;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-
-/**
- * This is a modisco content provider on which we can parameter the root element
- *
- * @deprecated Use SemanticUMLContentProvider instead
- */
-@Deprecated
-public class ModelContentProvider extends MoDiscoContentProvider implements IStaticContentProvider, IAdaptableContentProvider {
-
- /**
- * the root element of the tree explorer
- */
- protected EObject semanticRoot = null;
-
-
- /**
- * The StructuredViewer on which this content provider is applied
- */
- protected StructuredViewer viewer;
-
- public ModelContentProvider(EObject semanticRoot) {
- this.semanticRoot = semanticRoot;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object[] getElements() {
- return super.getElements(EditorUtils.getMultiDiagramEditor().getServicesRegistry());
- }
-
- @Override
- public EObject[] getRootElements(Object inputElement) {
- //if the semantic root is null, we use the default behavior
- if(semanticRoot == null) {
- return super.getRootElements(inputElement);
- } else {
- //we call the super, to ensure that all variable are initialized
- super.getRootElements(inputElement);
- EObject[] eobjectArray = { semanticRoot };
- return eobjectArray;
- }
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(viewer instanceof StructuredViewer) {
- this.viewer = (StructuredViewer)viewer;
- } else {
- this.viewer = null;
- }
- }
-
- public Object getAdaptedValue(Object selection) {
- if(selection instanceof IAdaptable) {
- EObject adapted = (EObject)((IAdaptable)selection).getAdapter(EObject.class);
- if(adapted != null) {
- return adapted;
- }
- }
- return selection;
- }
-
- public Object getContainerValue(Object selection) {
- if(selection instanceof EObject && viewer != null) {
- Object root = viewer.getInput();
- List<Object> rootElements = Arrays.asList(((ITreeContentProvider)viewer.getContentProvider()).getElements(root));
- List<Object> path = searchPath((EObject)selection, rootElements, new HashSet<Object>());
- if(!path.isEmpty()) {
- Object treeElement = path.get(path.size() - 1);
- return treeElement;
- }
- }
- return selection;
- }
-
- /**
- * look for the path the list of element (comes from the content provider) to go the eObject
- *
- * @param eobject
- * that we look for.
- * @param wrappers
- * a list of elements where eobject can be wrapped.
- * @param visitedElements
- * this parameters maintains the list of visited semantic elements,
- * to avoid infinite loops in infinite trees
- * @return the list of modelElementItem ( from the root to the element that wrap the eobject)
- */
- protected List<Object> searchPath(EObject lookFor, List<Object> wrappers, Set<Object> visitedElements) {
-
- if(lookFor == null) {
- return Collections.emptyList();
- }
- SemanticFromModelExplorer semanticGetter = new SemanticFromModelExplorer();
- List<Object> path = new ArrayList<Object>();
-
- for(Object wrapper : wrappers) {
- Object semanticElement = semanticGetter.getSemanticElement(wrapper);
- if(visitedElements.contains(semanticElement)) {
- continue;
- }
-
- if(!(semanticElement instanceof EReference)) {
- // Don't mark references themselves as visited, as they are meta-level singletons that should always be re-visited.
- visitedElements.add(semanticElement);
- }
-
- if(!isVisible(wrapper)) {
- continue;
- }
-
- // Search matches in this level
- if(!(wrapper instanceof Diagram) && wrapper instanceof IAdaptable) {
- if(lookFor.equals(semanticElement)) {
- path.add(wrapper);
- return path;
- }
- }
-
- // Find childs only for feature container and BigListItems
- //FIXME : Actually, we currently browse all references. We should only browse containment references
- //and a few specific references (To be determined by implementers, such as importPackage for UML)
- Object[] children = getChildren(wrapper);
- for(Object treeItem : children) {
- List<Object> tmppath = new ArrayList<Object>();
- if(treeItem instanceof BigListItem) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- } else {
- //can be change into IADAPTER by using new API of modisco
- Object element = semanticGetter.getSemanticElement(treeItem);
- if(element != null) {
- if(element instanceof EReference) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- } else if(element instanceof EObject) {
- List<Object> childs = new ArrayList<Object>();
- childs.add(treeItem);
- tmppath = searchPath(lookFor, childs, visitedElements);
- }
- }
- }
-
- // 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(lookFor.equals(semanticGetter.getSemanticElement(tmppath.get(tmppath.size() - 1)))) {
- path.add(wrapper);
- path.addAll(tmppath);
- return path;
- }
- }
- }
- }
- }
-
- return new ArrayList<Object>();
- }
-
- protected boolean isVisible(Object wrapper) {
- for(ViewerFilter filter : viewer.getFilters()) {
- if(!filter.select(viewer, null, wrapper)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
index c1e33a2c576..51d5774252f 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
@@ -27,7 +27,7 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IDetailLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java
deleted file mode 100644
index d85de9eb65a..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/StrategyBasedContentProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.infra.emf.providers.strategy;
-
-import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
-
-/**
- * @author Camille Letavernier
- *
- * @deprecated This class has been moved to infra.widgets
- */
-@Deprecated
-public class StrategyBasedContentProvider extends org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider {
-
- public StrategyBasedContentProvider(TreeBrowseStrategy browseStrategy, TreeBrowseStrategy revealStrategy) {
- super(browseStrategy, revealStrategy);
- }
-
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
index d2a60c27909..d3d919225bd 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
@@ -18,8 +18,8 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
new file mode 100644
index 00000000000..e905a18e661
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.emf.utils;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * ServicesUtils based on the Handler's ExecutionEvent
+ *
+ * It first tests the current selection, then the IWorkbenchPart on which the handler is executed.
+ * The IWorkbenchPart is expected to be adaptable to a ServiceRegistry.
+ *
+ * @author Camille Letavernier
+ *
+ * @see ServiceUtilsForSelection
+ */
+public class ServiceUtilsForHandlers extends AbstractServiceUtils<ExecutionEvent> {
+
+ private ServiceUtilsForHandlers() {
+ //Singleton
+ }
+
+ @Override
+ public ServicesRegistry getServiceRegistry(ExecutionEvent from) throws ServiceException {
+ Object context = from.getApplicationContext();
+ if(context instanceof IEvaluationContext) {
+ IEvaluationContext evaluationContext = (IEvaluationContext)context;
+ Object selection = evaluationContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+
+ ServicesRegistry registry;
+
+ //First, try to resolve the ServicesRegistry from the current selection
+ if(selection instanceof ISelection && !((ISelection)selection).isEmpty()) {
+ try {
+ registry = ServiceUtilsForSelection.getInstance().getServiceRegistry((ISelection)selection);
+ if(registry != null) {
+ return registry;
+ }
+ } catch (ServiceException ex) {
+ //Ignore and try another ServiceUtils
+ }
+ }
+
+ //We couldn't retrieve the ServiceRegistry from the current selection.
+
+ //Try to adapt the current part to the ServicesRegistry
+ IWorkbenchPart part = (IWorkbenchPart)evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
+ if(part instanceof IAdaptable) {
+ registry = (ServicesRegistry)((IAdaptable)part).getAdapter(ServicesRegistry.class);
+ if(registry != null) {
+ return registry;
+ }
+ }
+ }
+
+ throw new ServiceNotFoundException("The ServiceRegistry cannot be resolved");
+ }
+
+ public static ServiceUtilsForHandlers getInstance() {
+ return instance;
+ }
+
+ private static final ServiceUtilsForHandlers instance = new ServiceUtilsForHandlers();
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
new file mode 100644
index 00000000000..729668d4160
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.emf.utils;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
+
+/**
+ * ServiceUtils based on an ISelection.
+ *
+ * Expects an IStructuredSelection containing at least one EObject (It then relies on ServiceUtilsForEObject to retrieve the ServicesRegistry)
+ *
+ * @author Camille Letavernier
+ */
+public class ServiceUtilsForSelection extends AbstractServiceUtils<ISelection> {
+
+ private ServiceUtilsForSelection() {
+ //Singleton
+ }
+
+ private static ServiceUtilsForSelection instance = new ServiceUtilsForSelection();
+
+ public static ServiceUtilsForSelection getInstance() {
+ return instance;
+ }
+
+ @Override
+ public ServicesRegistry getServiceRegistry(ISelection from) throws ServiceException {
+ if(from instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection)from;
+ Iterator<?> selectionIterator = selection.iterator();
+ while(selectionIterator.hasNext()) {
+ Object selectedElement = selectionIterator.next();
+ EObject selectedEObject = EMFHelper.getEObject(selectedElement);
+ if(selectedEObject != null) {
+ return ServiceUtilsForEObject.getInstance().getServiceRegistry(selectedEObject);
+ }
+ }
+ }
+
+ throw new ServiceException("Cannot retrieve the ServiceRegistry");
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
index b25dcb33b63..5a0a230e0a7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
index 2e0d58204e0..51bfcd51a23 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleHandler.java
@@ -165,7 +165,7 @@ public abstract class AbstractStyleHandler extends AbstractHandler {
try {
resource.save(new HashMap<Object, Object>());
- (new CSSRefreshHandler()).execute(null);
+ (new CSSRefreshHandler()).execute(null); //FIXME: NPE on ExecutionEvent
} catch (IOException ex) {
Activator.log.error(ex);
MessageDialog.open(MessageDialog.ERROR, parentShell, "Style error", "An unexpected error occured while trying to save the Stylesheet", SWT.NONE);
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
index 2d417155736..05df777f2a3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.properties.creation,
org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding,
org.eclipse.papyrus.infra.gmfdiag.css.properties.provider
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
index 7bb1e6fbfa8..0bb5486c9ff 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
@@ -14,14 +14,12 @@ package org.eclipse.papyrus.infra.gmfdiag.css.engine;
import java.io.IOException;
import java.net.URL;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.SemanticElementHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
@@ -108,11 +106,7 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
public void handleChange(ChangeEvent event) {
resetCache();
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams(); //FIXME: Should be contextual. We should only refresh the editor(s) containing this Diagram
}
@Override
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
index 0a11f06bb5b..ffbc16063f6 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS;
import org.eclipse.e4.ui.css.core.dom.parsers.CSSParser;
import org.eclipse.e4.ui.css.core.dom.parsers.CSSParserFactory;
@@ -32,8 +31,7 @@ import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter;
import org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine;
import org.eclipse.e4.ui.css.core.impl.sac.CSSConditionFactoryImpl;
import org.eclipse.e4.ui.css.core.impl.sac.CSSSelectorFactoryImpl;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.BooleanConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.ColorToGMFConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.IntegerConverter;
@@ -355,11 +353,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams(); //TODO: Contextual refresh
}
});
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
index 61026e56ede..ef64e7768c7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java
@@ -11,97 +11,16 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.helper;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.Activator;
/**
* A Helper for retrieving Views and Semantic elements from a
* compatible object.
*
* @author Camille Letavernier
+ *
+ * @deprecated moved to org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper
*/
-public class SemanticElementHelper {
-
- /**
- * Returns the semantic element attached to the given notation element
- *
- * The result element can also be a Diagram
- *
- * @param notationElement
- * @return
- */
- public static EObject findSemanticElement(EObject notationElement) {
- if(notationElement == null) {
- return null;
- }
- if(notationElement instanceof Diagram) {
- return notationElement;
- }
- if(notationElement instanceof View) {
- View view = (View)notationElement;
- EObject semanticElement = view.getElement();
- if(semanticElement != null) {
- return semanticElement;
- }
- //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
- //e.g. : Links in UML
- return view;
- }
-
- EObject currentElement = notationElement.eContainer();
-
- do {
- if(currentElement instanceof View) {
- return findSemanticElement(currentElement);
- }
- currentElement = currentElement.eContainer();
- } while(currentElement != null);
-
- Activator.log.warn("Cannot find a valid source for " + notationElement);
- return notationElement;
- }
-
- /**
- * Retrieves the primary view associated to the argument.
- *
- * For example, for a compartment, this method will return the top-most
- * view associated to the same semantic element.
- *
- * @param notationElement
- * @return
- */
- public static View findPrimaryView(EObject notationElement) {
- return findTopView(notationElement);
- }
-
- /**
- * Finds the top-most View associated to the same semantic
- * element as the argument.
- *
- * @param notationElement
- * @return
- */
- public static View findTopView(EObject notationElement) {
- EObject semanticElement = findSemanticElement(notationElement);
-
- if(semanticElement == notationElement) {
- return (View)notationElement;
- }
-
- EObject lastNotationElement = notationElement;
- while(notationElement != null) {
- notationElement = notationElement.eContainer();
- if(findSemanticElement(notationElement) != semanticElement) {
- return (View)lastNotationElement;
- }
-
- if(notationElement != null) {
- lastNotationElement = notationElement;
- }
- }
-
- return (View)lastNotationElement;
- }
+@Deprecated
+public class SemanticElementHelper extends org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper {
+ //Deprecated
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
index db2f453f4e7..84b17145b6e 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
@@ -13,12 +13,11 @@ package org.eclipse.papyrus.infra.gmfdiag.css.preferences;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
import org.eclipse.papyrus.infra.gmfdiag.css.theme.Theme;
@@ -74,11 +73,7 @@ public class ThemePreferencesPage extends FieldEditorPreferencePage implements I
boolean result = super.performOk();
if(needsRefresh) {
WorkspaceCSSEngine.instance.reset();
- try {
- (new RefreshHandler()).execute(null);
- } catch (ExecutionException ex) {
- Activator.log.error(ex);
- }
+ DiagramHelper.refreshDiagrams();
}
return result;
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif
index a2017d01c82..a2017d01c82 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/none_comp_vis.gif
Binary files differ
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index 08ebb6b22a6..e164ecd4648 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -108,7 +108,7 @@
point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
<labelProvider
priority="40"
- provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramFilteredLabelProvider">
+ provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.NotationFilteredLabelProvider">
</labelProvider>
</extension>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
index 9c3d282ca61..6e556b0b22b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
@@ -54,6 +54,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.uml.tools.model.UmlUtils;
import org.eclipse.swt.widgets.Display;
@@ -81,12 +82,17 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
+ ServicesRegistry registry;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException ex) {
+ throw new ExecutionException("Cannot retrieve the ServicesRegistry", ex);
+ }
+
EObject container = null;
// if editor is open and active
- if(getMultiDiagramEditor() != null) {
- container = getSelectedElement();
- }
- runAsTransaction(container);
+ container = getSelectedElement();
+ runAsTransaction(container, registry);
return null;
}
@@ -98,13 +104,13 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
* The uml element to which the diagram should be attached, if possible.
* @throws ExecutionException
*/
- protected void runAsTransaction(EObject container) throws ExecutionException {
+ protected void runAsTransaction(EObject container, ServicesRegistry registry) throws ExecutionException {
ModelSet modelSet;
try {
- modelSet = EditorUtils.getServiceRegistry().getService(ModelSet.class);
+ modelSet = registry.getService(ModelSet.class);
} catch (ServiceException e) {
- throw new ExecutionException("Can't get diResourceSet", e);
+ throw new ExecutionException("Can't get ModelSet", e);
}
runAsTransaction(modelSet, container, null);
@@ -343,22 +349,17 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
}
/**
- * Get the ServiceRegistry of the main editor.
- *
- * @return
- */
- protected ServicesRegistry getServiceRegistry() {
- return EditorUtils.getServiceRegistry();
- }
-
- /**
* Get the ISashWindowsContentProvider from the main editor.
*
* @return
*/
- protected ISashWindowsContentProvider getISashWindowsContentProvider() {
- return EditorUtils.getISashWindowsContentProvider();
-
+ protected ISashWindowsContentProvider getISashWindowsContentProvider(ServicesRegistry registry) {
+ try {
+ return registry.getService(ISashWindowsContentProvider.class);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
index 75098981f31..e1fceec6dcb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
@@ -14,10 +14,9 @@ package org.eclipse.papyrus.infra.gmfdiag.common.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
import org.eclipse.ui.IEditorPart;
@@ -32,17 +31,16 @@ import org.eclipse.ui.IEditorPart;
public class RefreshHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
- IMultiDiagramEditor multiDiagramEditor = EditorUtils.getMultiDiagramEditor();
- if(multiDiagramEditor != null) {
- IEditorPart activeEditor = multiDiagramEditor.getActiveEditor();
- if(activeEditor instanceof DiagramEditor) {
- DiagramEditor diagramEditor = (DiagramEditor)activeEditor;
- DiagramEditPart topEditPart = diagramEditor.getDiagramEditPart();
- if(topEditPart != null) {
- DiagramHelper.refresh(topEditPart, true);
- }
- }
+ IEditorPart activeEditor;
+ try {
+ activeEditor = ServiceUtilsForHandlers.getInstance().getNestedActiveIEditorPart(event);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
}
+
+ DiagramHelper.refresh(activeEditor);
+
return null;
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
index 470f3f05b26..b5208b6cf2c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
@@ -15,6 +15,10 @@ import java.util.List;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.ui.IEditorPart;
public class DiagramHelper {
@@ -39,4 +43,34 @@ public class DiagramHelper {
}
}
}
+
+ /**
+ * Refreshes all diagrams in this IEditorPart (Including nested editors when necessary)
+ *
+ * @param editorPart
+ */
+ //FIXME: The current implementation only refreshes the active editor diagram
+ public static void refresh(IEditorPart editorPart) {
+ if(editorPart instanceof IMultiDiagramEditor) {
+ editorPart = ((IMultiDiagramEditor)editorPart).getActiveEditor();
+ }
+
+ if(editorPart instanceof DiagramEditor) {
+ DiagramEditor diagramEditor = (DiagramEditor)editorPart;
+ DiagramEditPart topEditPart = diagramEditor.getDiagramEditPart();
+ if(topEditPart != null) {
+ DiagramHelper.refresh(topEditPart, true);
+ }
+ }
+ }
+
+ /**
+ * Refreshes all opened diagrams
+ */
+ //FIXME: The current implementation only refreshes the active diagrams
+ public static void refreshDiagrams() {
+ for(IMultiDiagramEditor activeMultiEditor : EditorUtils.getMultiDiagramEditors()) {
+ refresh(activeMultiEditor);
+ }
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java
new file mode 100644
index 00000000000..541207e1eed
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/SemanticElementHelper.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.gmfdiag.common.helper;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.Activator;
+
+/**
+ * A Helper for retrieving Views and Semantic elements from a
+ * compatible object.
+ *
+ * @author Camille Letavernier
+ */
+public class SemanticElementHelper {
+
+ /**
+ * Returns the semantic element attached to the given notation element
+ *
+ * The result element can also be a Diagram
+ *
+ * @param notationElement
+ * @return
+ */
+ public static EObject findSemanticElement(EObject notationElement) {
+ if(notationElement == null) {
+ return null;
+ }
+ if(notationElement instanceof Diagram) {
+ return notationElement;
+ }
+ if(notationElement instanceof View) {
+ View view = (View)notationElement;
+ EObject semanticElement = view.getElement();
+ if(semanticElement != null) {
+ return semanticElement;
+ }
+ //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
+ //e.g. : Links in UML
+ return view;
+ }
+
+ EObject currentElement = notationElement.eContainer();
+
+ do {
+ if(currentElement instanceof View) {
+ return findSemanticElement(currentElement);
+ }
+ currentElement = currentElement.eContainer();
+ } while(currentElement != null);
+
+ Activator.log.warn("Cannot find a valid source for " + notationElement);
+ return notationElement;
+ }
+
+ /**
+ * Retrieves the primary view associated to the argument.
+ *
+ * For example, for a compartment, this method will return the top-most
+ * view associated to the same semantic element.
+ *
+ * @param notationElement
+ * @return
+ */
+ public static View findPrimaryView(EObject notationElement) {
+ return findTopView(notationElement);
+ }
+
+ /**
+ * Finds the top-most View associated to the same semantic
+ * element as the argument.
+ *
+ * @param notationElement
+ * @return
+ */
+ public static View findTopView(EObject notationElement) {
+ EObject semanticElement = findSemanticElement(notationElement);
+
+ if(semanticElement == notationElement) {
+ return (View)notationElement;
+ }
+
+ EObject lastNotationElement = notationElement;
+ while(notationElement != null) {
+ notationElement = notationElement.eContainer();
+ if(findSemanticElement(notationElement) != semanticElement) {
+ return (View)lastNotationElement;
+ }
+
+ if(notationElement != null) {
+ lastNotationElement = notationElement;
+ }
+ }
+
+ return (View)lastNotationElement;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java
index cd18f08304e..8a4b214fab6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramFilteredLabelProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationFilteredLabelProvider.java
@@ -13,17 +13,18 @@ package org.eclipse.papyrus.infra.gmfdiag.common.providers;
import java.util.Iterator;
-import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
/**
- * A FilteredLabelProvider for GMF Diagrams
+ * A FilteredLabelProvider for GMF Notation model
*
* @author Camille Letavernier
*/
-public class DiagramFilteredLabelProvider extends DiagramLabelProvider implements IFilteredLabelProvider {
+public class NotationFilteredLabelProvider extends NotationLabelProvider implements IFilteredLabelProvider {
public boolean accept(IStructuredSelection selection) {
@@ -47,8 +48,9 @@ public class DiagramFilteredLabelProvider extends DiagramLabelProvider implement
return accept((IStructuredSelection)element);
}
- //The element is a Diagram or can be adapted to a Diagram
- return EMFHelper.getEObject(element) instanceof Diagram;
+ //Accept elements from the Notation metamodel
+ EObject eObject = EMFHelper.getEObject(element);
+ return eObject != null && eObject.eClass().getEPackage() == NotationPackage.eINSTANCE;
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java
index 8ff4331d960..18e3c9f2c76 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/DiagramLabelProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/NotationLabelProvider.java
@@ -12,18 +12,28 @@
package org.eclipse.papyrus.infra.gmfdiag.common.providers;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.tools.Activator;
import org.eclipse.swt.graphics.Image;
/**
- * A Label Provider for GMF Diagrams
+ * A Label Provider for GMF Notation model
*/
-public class DiagramLabelProvider extends EMFLabelProvider {
+public class NotationLabelProvider extends EMFLabelProvider {
+
+ /** icon for a compartment */
+ public static final String ICON_COMPARTMENT = "/icons/none_comp_vis.gif"; //$NON-NLS-1$
@Override
protected Image getImage(EObject element) {
@@ -40,6 +50,11 @@ public class DiagramLabelProvider extends EMFLabelProvider {
return registry.getEditorIcon(element);
}
+ // if the element is a compartment
+ if(element instanceof BasicCompartment || element instanceof DecorationNode) {
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, ICON_COMPARTMENT);
+ }
+
return super.getImage(element);
}
@@ -60,6 +75,13 @@ public class DiagramLabelProvider extends EMFLabelProvider {
return ((Diagram)element).getName();
}
+ if(element instanceof View) { // maybe it is a view of a compartment
+ EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View)element);
+ if(dummyEP instanceof ResizableCompartmentEditPart) {
+ return ((ResizableCompartmentEditPart)dummyEP).getCompartmentName();
+ }
+ }
+
return super.getText(element);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
index 7aadf41c8e4..91831f43665 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/strategy/TransactionalDropStrategy.java
@@ -79,5 +79,16 @@ public abstract class TransactionalDropStrategy extends AbstractDropStrategy {
return EMFHelper.resolveEditingDomain(targetEditPart);
}
- public abstract Command doGetCommand(Request request, EditPart targetEditPart);
+ /**
+ * The command to be executed when the strategy is applied.
+ * Should return null if the strategy cannot handle the request.
+ *
+ * @param request
+ * The drop request
+ * @param targetEditPart
+ * The target edit part
+ * @return
+ * A command, or null if the strategy cannot handle the request
+ */
+ protected abstract Command doGetCommand(Request request, EditPart targetEditPart);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
index 7fad33192f0..a9608b11f8f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramIcon.java
@@ -16,13 +16,12 @@ import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionExcep
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
/** Return the path to the icon of the corresponding diagram */
public class GetDiagramIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<Diagram, String> {
public String evaluate(final Diagram context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
index e22dd5a4f27..6b8b5f39213 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
index 7146d55c730..f47912f0b5d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/build.properties
@@ -8,6 +8,6 @@ bin.includes = META-INF/,\
about.html,\
icons/
output..=bin/
-src.includes = about.html.
+src.includes = about.html
source..=src/
bin..=bin/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
index e900603edc5..4f62d238078 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/Activator.java
@@ -12,6 +12,7 @@
*/
package org.eclipse.papyrus.infra.gmfdiag.navigation;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.papyrus.infra.gmfdiag.navigation.preference.NavigationPreferenceInitializer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -27,6 +28,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -43,6 +46,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
NavigationPreferenceInitializer preferenceInitializer = new NavigationPreferenceInitializer();
preferenceInitializer.initializeDefaultPreferences();
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
index 1d8e7bde33b..3f06d81d76b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/CreateDiagramWithNavigationHandler.java
@@ -29,8 +29,11 @@ import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.extension.commands.ICreationCondition;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.widgets.toolbox.dialog.InformationDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
@@ -64,12 +67,19 @@ public abstract class CreateDiagramWithNavigationHandler extends AbstractHandler
public Object execute(ExecutionEvent event) throws ExecutionException {
NavigableElement navElement = getNavigableElementWhereToCreateDiagram();
+ ServicesRegistry registry;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
if(navElement == null) {
InformationDialog dialog = new InformationDialog(Display.getCurrent().getActiveShell(), "Impossible diagram creation", "It is not possible to create this diagram on the selected element.", null, null, SWT.OK, MessageDialog.WARNING, new String[]{ IDialogConstants.OK_LABEL });
dialog.open();
} else {
- createDiagram(navElement);
+ createDiagram(navElement, registry);
}
return null;
}
@@ -98,8 +108,14 @@ public abstract class CreateDiagramWithNavigationHandler extends AbstractHandler
return null;
}
- private void createDiagram(NavigableElement navElement) {
- ModelSet modelSet = EditorUtils.getDiResourceSet();
+ private void createDiagram(NavigableElement navElement, ServicesRegistry registry) {
+ ModelSet modelSet;
+ try {
+ modelSet = ServiceUtils.getInstance().getModelSet(registry);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
if(navElement != null && modelSet != null) {
try {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java
deleted file mode 100644
index 417190b7159..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/utils/MultiDiagramDialog.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 AtoS
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Anass RADOUANI (AtoS)
- *******************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.navigation.utils;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * This class Provide a dialog filled with a list of reachable diagrams
- *
- * @author aradouan
- *
- */
-public class MultiDiagramDialog extends Dialog {
-
- private List<Diagram> diagrams;
-
- private Composite dialogComposite;
-
- protected int selectedDiagram;
-
- private Table table;
-
- private TableViewer list;
-
- public int getSelectedDiagram() {
- return selectedDiagram;
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.MultiDiagramDialog_0);
- }
-
- public MultiDiagramDialog(Shell parentShell, List<Diagram> diagrams) {
- super(parentShell);
- this.diagrams = diagrams;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- dialogComposite = (Composite)super.createDialogArea(parent);
- parent.setLayout(new GridLayout());
- dialogComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- createDialogComposite();
- createDialogContents(dialogComposite);
- hookListeners();
- loadData();
- defaultSelection();
-
- return dialogComposite;
- }
-
- private void createDialogContents(Composite parent) {
- dialogComposite.setLayout(new GridLayout(1, false));
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.HORIZONTAL));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
-
- Label lblDiagrams = new Label(composite, SWT.NONE);
- lblDiagrams.setText(Messages.MultiDiagramDialog_1);
-
- Composite composite_1 = new Composite(parent, SWT.NONE);
- composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite_1.setLayout(new GridLayout(1, false));
-
- list = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
- list.setUseHashlookup(true);
- table = list.getTable();
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- list.setLabelProvider(new MoDiscoLabelProvider());
- list.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof List) {
- return ((List)inputElement).toArray();
- } else {
- return new Object[]{ inputElement };
- }
- }
- });
- }
-
- private void createDialogComposite() {
- GridData dialogLayoutData = new GridData(GridData.FILL_BOTH);
- dialogComposite.setLayoutData(dialogLayoutData);
-
- }
-
- private void hookListeners() {
- table.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- MultiDiagramDialog.this.selectedDiagram = table.getSelectionIndex();
- }
-
- });
- }
-
- private void loadData() {
- list.setInput(diagrams);
- }
-
- private void defaultSelection() {
- boolean found = false;
- IPageMngr pageMngr;
- try {
- pageMngr = EditorUtils.getServiceRegistry().getService(IPageMngr.class);
-
- for(Diagram diagram : diagrams) {
- if(pageMngr.isOpen(diagram)) {
- table.select(diagrams.indexOf(diagram));
- found = true;
- break;
- }
- }
- } catch (ServiceException e) {
- e.printStackTrace();
- }
-
- if(!found) {
- table.select(0);
- }
- }
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
index 5438af5fce8..8bd9ca901a4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/META-INF/MANIFEST.MF
@@ -8,7 +8,9 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.outline,
org.eclipse.papyrus.infra.gmfdiag.outline.internal;x-internal:=true,
org.eclipse.papyrus.infra.gmfdiag.outline.overview
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
index 7a4248cb36b..437e8de24d1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramNavigator.java
@@ -24,7 +24,6 @@ import org.eclipse.emf.edit.provider.IViewerNotification;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
@@ -32,7 +31,11 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.papyrus.commands.ICreationCommandRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.gmfdiag.outline.internal.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -60,6 +63,8 @@ public class DiagramNavigator extends Composite {
*/
ICreationCommandRegistry creationCommandRegistry;
+ private final ServicesRegistry registry;
+
/**
* This content provider filters the event from graphical object to only refresh when it's
* needed.
@@ -109,8 +114,9 @@ public class DiagramNavigator extends Composite {
* @param pageSite
* the site
*/
- public DiagramNavigator(Composite parent, IPageSite pageSite) {
+ public DiagramNavigator(Composite parent, IPageSite pageSite, ServicesRegistry registry) {
super(parent, SWT.BORDER);
+ this.registry = registry;
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
@@ -149,15 +155,16 @@ public class DiagramNavigator extends Composite {
* Set the tree providers for the outline
*/
protected void initProviders() {
- AdapterFactoryContentProvider adapterContentProvider = new NavigatorAdapterFactoryContentProvider(
- getAdapterFactory());
+ AdapterFactoryContentProvider adapterContentProvider = new NavigatorAdapterFactoryContentProvider(getAdapterFactory());
adapterContentProvider.inputChanged(viewer, null, null);
viewer.setContentProvider(new DiagramOrientedContentProvider(adapterContentProvider));
- ILabelProvider labelProvider = new DiagramOrientedLabelProvider(new AdapterFactoryLabelProvider(
- getAdapterFactory()));
- ILabelProvider fullLabelProvider = new DecoratingLabelProvider(labelProvider, Activator.getDefault()
- .getWorkbench().getDecoratorManager().getLabelDecorator());
- viewer.setLabelProvider(fullLabelProvider);
+ try {
+ ILabelProvider labelProvider = ServiceUtils.getInstance().getService(LabelProviderService.class, registry).getLabelProvider();
+ ILabelProvider fullLabelProvider = new DecoratingLabelProvider(labelProvider, Activator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator());
+ viewer.setLabelProvider(fullLabelProvider);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java
deleted file mode 100644
index 28a25a4433f..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOrientedLabelProvider.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/***********************************************************************
- * Copyright (c) 2008, 2009 Anyware Technologies, Obeo
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Sciamma (Anyware Technologies) - initial API and implementation
- *
- **********************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.outline;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Compute the label of the elements contained by the current diagram.
- *
- * @author <a href="mailto:david.sciamma@anyware-tech.com">David Sciamma</a>
- * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques Lescot</a>
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public class DiagramOrientedLabelProvider implements ILabelProvider {
-
- private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider;
-
- /** Registry to store editor factories */
- private IPageIconsRegistry editorRegistry;
-
- public DiagramOrientedLabelProvider(AdapterFactoryLabelProvider adapterFactoryLabelProvider) {
- this.myAdapterFactoryLabelProvider = adapterFactoryLabelProvider;
- }
-
- /**
- * {@inheritDoc}
- */
- public Image getImage(Object element) {
- if(element instanceof Diagram) {
- return getEditorRegistry().getEditorIcon(element);
- }
-
- return myAdapterFactoryLabelProvider.getImage(element);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getText(Object element) {
- if(element instanceof Diagram) {
- Diagram diagram = (Diagram)element;
- return myAdapterFactoryLabelProvider.getText(diagram.getElement());
- }
-
- return myAdapterFactoryLabelProvider.getText(element);
- }
-
- /**
- * {@inheritDoc}
- */
- public void addListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.addListener(listener);
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
- myAdapterFactoryLabelProvider.dispose();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isLabelProperty(Object element, String property) {
- return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.removeListener(listener);
- }
-
- /**
- * Get the EditorRegistry used to create editor instances. This default implementation return
- * the singleton eINSTANCE. This method can be subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- * @throws ServiceException
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should implements this
- * method in order to return the registry associated to the extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- * @throws ServiceException
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each request.
- return new PageIconsRegistry();
- }
- }
-
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
index 1519fff317b..ef0c70d9bb0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
@@ -222,7 +222,7 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
}
private DiagramNavigator createNavigator(Composite parent, IPageSite pageSite) {
- return new DiagramNavigator(parent, pageSite);
+ return new DiagramNavigator(parent, pageSite, multiEditor.getServicesRegistry());
}
@Override
@@ -281,7 +281,11 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
refreshSelection();
// Refresh outline contents content with the new selection
- refresh();
+ try {
+ refresh(); //When outline breaks, the selectionChangeEvent is borken too. It may prevent the others views from receiving it...
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -290,7 +294,7 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
private void refreshSelection() {
if(multiEditor.getActiveEditor() != null) {
- GraphicalViewer viewer = (GraphicalViewer)multiEditor.getActiveEditor().getAdapter(GraphicalViewer.class);
+ GraphicalViewer viewer = (GraphicalViewer)multiEditor.getAdapter(GraphicalViewer.class);
if(viewer == null) { // In case of an editor that is not GEF based.
root = null;
diagram = null;
@@ -324,7 +328,6 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
//FIXME: Sometimes, this method is called before #createControl(), which results in a NPE with sashComp
//Temporary fix : A non-null test has been added to avoid breaking the view
private void refresh() {
-
// Trash and re-Create Overview
if((overview != null) && !(overview.isDisposed())) {
overview.dispose();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
index 2c17ed1441e..65c0af373e8 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
@@ -47,7 +47,7 @@
</page>
<page
category="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusDiagramsPreferencePage"
+ class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage"
id="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusAllDiagramsPreferencePage"
name="Diagrams">
<enabledWhen>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
index cbbb7cf01fa..ae3cd45b5b1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom,
org.eclipse.papyrus.infra.gmfdiag.properties.extension,
org.eclipse.papyrus.infra.gmfdiag.properties.modelelement
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
index 49c6626c916..f85b81ae344 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GMFModelElement.java
@@ -21,8 +21,12 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.GradientObservableValue;
-import org.eclipse.papyrus.infra.gmfdiag.properties.providers.GMFLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableList;
import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
@@ -84,7 +88,12 @@ public class GMFModelElement extends EMFModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
- return new GMFLabelProvider();
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, source).getLabelProvider();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return new LabelProvider();
+ }
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java
deleted file mode 100644
index f0334d597a4..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/providers/GMFLabelProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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.infra.gmfdiag.properties.providers;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An EMFObjectLabelProvider with support for GMF Diagram icons
- *
- * @author Camille Letavernier
- *
- */
-public class GMFLabelProvider extends EMFLabelProvider {
-
- protected IPageIconsRegistry editorRegistry;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Image getImage(Object element) {
-
- if(element instanceof Diagram) {
- return getEditorRegistry().getEditorIcon(element);
- }
-
- return super.getImage(element);
- }
-
- /**
- * Get the EditorRegistry used to create editor instances. This default
- * implementation return the singleton eINSTANCE. This method can be
- * subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each
- // request.
- return new PageIconsRegistry();
- }
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
index 47b08bc75b8..246eb2af498 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF
@@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.facet.infra.query;bundle-version="0.1.0",
org.eclipse.emf.facet.infra.query.core;bundle-version="0.1.0",
org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
- org.eclipse.emf.facet.infra.browser.custom.core;bundle-version="0.1.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.papyrus.infra.tools;bundle-version="0.10.0";visibility:=reexport,
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
index 25ba04612ed..f9248c98c6f 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.emf.common.ui;bundle-version="2.7.0",
org.eclipse.papyrus.infra.onefile;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.export
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
index b12d5e4cd3b..32fe14d66de 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
@@ -139,7 +139,9 @@ public class ExportAllDiagrams {
try {
op.run(monitor);
} catch (InvocationTargetException e) {
+ Activator.log.error(e);
} catch (InterruptedException e) {
+ Activator.log.error(e);
}
return Status.OK_STATUS;
}
@@ -200,7 +202,7 @@ public class ExportAllDiagrams {
} catch (RollbackException e) {
}
} else {
- Activator.log("no transactional editing domain found", Status.WARNING);
+ Activator.log.warn("no transactional editing domain found");
}
List<Diagram> diagrams = new ArrayList<Diagram>();
@@ -219,7 +221,7 @@ public class ExportAllDiagrams {
newMonitor.worked(1);
export(new SubProgressMonitor(newMonitor, 9), diagrams);
} else {
- Activator.log(new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.ExportAllDiagrams_3));
+ Activator.log.warn(Messages.ExportAllDiagrams_3);
}
}
@@ -248,7 +250,7 @@ public class ExportAllDiagrams {
diagnostic.add(newDiagnostic);
} else {
- Activator.log(new Status(Status.INFO, Activator.PLUGIN_ID, message));
+ Activator.log.info(message);
}
}
@@ -341,7 +343,7 @@ public class ExportAllDiagrams {
}
} catch (SWTError e) {
String message = Messages.ExportAllDiagrams_9;
- Activator.log(new Exception(message, e));
+ Activator.log.error(message, new Exception(message, e));
}
} catch (Exception e) {
e.printStackTrace();
@@ -357,7 +359,8 @@ public class ExportAllDiagrams {
} catch (Throwable e) {
BasicDiagnostic newDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "", 0, String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString()), null); //$NON-NLS-1$
diagnostic.add(newDiagnostic);
- Activator.log(String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString()), IStatus.ERROR, e);
+ String errorMessage = String.format(Messages.ExportAllDiagrams_11, uniqueFileName, diagram.eResource().getURI().toString());
+ Activator.log.error(errorMessage, e);
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
index 0931cbbf080..1dafe8540c9 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/internal/Activator.java
@@ -11,12 +11,9 @@
package org.eclipse.papyrus.infra.export.internal;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -36,6 +33,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -46,13 +45,16 @@ public class Activator extends AbstractUIPlugin {
/**
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
+ log = new LogHelper(this);
}
/**
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@@ -68,65 +70,6 @@ public class Activator extends AbstractUIPlugin {
}
/**
- * Log an IStatus
- *
- * @param status
- * Status of an operation
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Log a message with given level into the Eclipse log file
- *
- * @param message
- * the message to log
- * @param level
- * the message priority
- */
- public static void log(String message, int level) {
- IStatus status = null;
- status = new Status(level, PLUGIN_ID, IStatus.OK, message, null);
- log(status);
- }
-
- /**
- * Log a message with given level into the Eclipse log file
- *
- * @param message
- * the message to log
- * @param level
- * the message priority
- */
- public static void log(String message, int level, Throwable t) {
- IStatus status = null;
- status = new Status(level, PLUGIN_ID, IStatus.OK, message, t);
- log(status);
- }
-
- /**
- * Log an exception into the Eclipse log file
- *
- * @param e
- * the exception to log
- */
- public static void log(Throwable e) {
- Throwable loggedThrowable = e;
- if(loggedThrowable instanceof InvocationTargetException) {
- loggedThrowable = ((InvocationTargetException)loggedThrowable).getTargetException();
- }
-
- IStatus status = null;
- if(loggedThrowable instanceof CoreException) {
- status = ((CoreException)loggedThrowable).getStatus();
- } else {
- status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Error", loggedThrowable);
- }
- log(status);
- }
-
- /**
* Returns the active workbench shell
*
* @return the active workbench shell
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
index 0df2db68c4d..fbd0aaf6882 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/DocumentHyperLinkHelper.java
@@ -34,23 +34,21 @@ import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
/**
* this an helper to manage hyperlink document
- *
+ *
*/
-
public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
-
+
@Override
public HyperLinkObject getHyperLinkObject(EAnnotation eAnnotation) {
if(eAnnotation.getSource().equals(HyperLinkConstants.HYPERLINK_DOCUMENT)) {
HyperLinkDocument hyperLinkDocument = new HyperLinkDocument();
hyperLinkDocument.setHyperlinkDocument(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_DOCUMENT_LOCALIZATION));
hyperLinkDocument.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT));
- if(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION)!=null){
- boolean isDefaultNaviagation=Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION));
+ if(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION) != null) {
+ boolean isDefaultNaviagation = Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION));
hyperLinkDocument.setIsDefault(isDefaultNaviagation);
- }
- else{
+ } else {
hyperLinkDocument.setIsDefault(false);
}
@@ -59,18 +57,22 @@ public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
return null;
}
+
@Override
public RecordingCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperlinkObject) {
- if( hyperlinkObject instanceof HyperLinkDocument){
- HyperLinkDocument hyperLinkDocument= (HyperLinkDocument)hyperlinkObject;
- return new CreateHyperLinkDocumentCommand(domain, object, hyperLinkDocument.getTooltipText(), hyperLinkDocument.getHyperlinkDocument(),hyperlinkObject.getIsDefault());
+ if(hyperlinkObject instanceof HyperLinkDocument) {
+ HyperLinkDocument hyperLinkDocument = (HyperLinkDocument)hyperlinkObject;
+ return new CreateHyperLinkDocumentCommand(domain, object, hyperLinkDocument.getTooltipText(), hyperLinkDocument.getHyperlinkDocument(), hyperlinkObject.getIsDefault());
+ } else {
+ return null;
}
- else{return null;}
}
+
@Override
public String getNameofManagedHyperLink() {
return Messages.DocumentHyperLinkHelper_Document;
}
+
@Override
public void executeNewMousePressed(List<HyperLinkObject> list, EObject aModel) {
EditorHyperlinkDocumentShell editor = new EditorHyperlinkDocumentShell();
@@ -80,14 +82,14 @@ public class DocumentHyperLinkHelper extends AbstractHyperLinkHelper {
}
}
-
+
@Override
public List<HyperLinkObject> getFilteredObject(List<HyperLinkObject> hyperlinkObjects) {
- ArrayList<HyperLinkObject> result= new ArrayList<HyperLinkObject>();
- Iterator<HyperLinkObject> iterator= hyperlinkObjects.iterator();
+ ArrayList<HyperLinkObject> result = new ArrayList<HyperLinkObject>();
+ Iterator<HyperLinkObject> iterator = hyperlinkObjects.iterator();
while(iterator.hasNext()) {
- HyperLinkObject hyperlinkObject = (HyperLinkObject)iterator.next();
- if(hyperlinkObject instanceof HyperLinkDocument){
+ HyperLinkObject hyperlinkObject = iterator.next();
+ if(hyperlinkObject instanceof HyperLinkDocument) {
result.add(hyperlinkObject);
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
index d298c905754..6354010cc2c 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/EditorHyperLinkHelper.java
@@ -23,10 +23,9 @@ import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
import org.eclipse.papyrus.infra.hyperlink.messages.Messages;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
@@ -56,15 +55,15 @@ public class EditorHyperLinkHelper extends AbstractHyperLinkHelper {
*/
@Override
public void executeNewMousePressed(final List<HyperLinkObject> list, final EObject aModel) {
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ IPageIconsRegistry editorRegistry;
try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
+ editorRegistry = ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, aModel);
} catch (ServiceException e) {
Activator.log.error(e);
+ return;
}
EditorHyperLinkEditorShell editor = new EditorHyperLinkEditorShell(editorRegistry, aModel);
- editor.open();//TODO and the cancel?
+ editor.open();
if(editor.getHyperLinkEditor() != null) {
list.add(editor.getHyperLinkEditor());
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
index 637cd502085..c6e306f06ca 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/object/HyperLinkEditor.java
@@ -16,11 +16,9 @@ package org.eclipse.papyrus.infra.hyperlink.object;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
@@ -56,13 +54,14 @@ public class HyperLinkEditor extends HyperLinkObject {
*/
@Override
public void executeEditMousePressed(List<HyperLinkObject> list, EObject amodel) {
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ IPageIconsRegistry editorRegistry;
try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
+ editorRegistry = ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, amodel);
} catch (ServiceException e) {
Activator.log.error(e);
+ return;
}
+
EditorHyperLinkEditorShell editor = new EditorHyperLinkEditorShell(editorRegistry, amodel);
editor.setHyperLinkEditor(this);
editor.open();
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
index e95ea10fb97..a5087026772 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
@@ -35,7 +35,6 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -244,7 +243,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
diagramListTreeViewer.setLabelProvider(labelProvider);
- diagramListTreeViewer.setContentProvider(new EditorListContentProvider());
+ diagramListTreeViewer.setContentProvider(new EditorListContentProvider(model));
diagramListTreeViewer.setInput(" "); //$NON-NLS-1$
// add listner on the new button to display menu for each diagram
@@ -270,10 +269,18 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
IStructuredSelection iSelection = (IStructuredSelection)getModeFilteredTree().getViewer().getSelection();
- Iterator iterator = iSelection.iterator();
+ Iterator<?> iterator = iSelection.iterator();
+
+ IPageMngr pageManager;
+ try {
+ pageManager = ServiceUtilsForEObject.getInstance().getIPageMngr(model);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
while(iterator.hasNext()) {
- IPageMngr pageMngr = EditorUtils.getIPageMngr();
- pageMngr.removePage(iterator.next());
+ pageManager.removePage(iterator.next());
}
getDiagramfilteredTree().getViewer().setInput(null);
getDiagramfilteredTree().getViewer().setInput(""); //$NON-NLS-1$
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
index afaa710665b..9af9b1cab01 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/HyperLinkTab.java
@@ -21,10 +21,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
@@ -204,13 +201,7 @@ public class HyperLinkTab extends AbstractHyperLinkTab {
downHyperLinkButton.setLayoutData(gridData3);
addListeners();
tableViewer.setContentProvider(contentProvider);
- IPageIconsRegistry editorRegistry = null;
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
- try {
- editorRegistry = papyrusEditor.getServicesRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
+
this.hyperlinkObjects = hyperLinkHelper.getFilteredObject(hyperlinkObjects);
ILabelProvider provider = null;
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
index fccf86c7c2e..ce121ef5984 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/EditorListContentProvider.java
@@ -16,20 +16,27 @@ package org.eclipse.papyrus.infra.hyperlink.util;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.hyperlink.Activator;
/**
- * The Class DiagramContentProvider.
+ * The Class EditorListContentProvider.
*/
//TODO why a tree content provider
-//TODO : extends the label provider of the ModelExplorer to get the customization
public class EditorListContentProvider implements ITreeContentProvider {
+ //The context of the ContentProvider
+ private EObject model;
+
+ public EditorListContentProvider(EObject model) {
+ this.model = model;
+ }
+
/**
* {@inheritDoc}
*/
@@ -56,14 +63,14 @@ public class EditorListContentProvider implements ITreeContentProvider {
*/
public Object[] getElements(Object inputElement) {
try {
- IPageMngr iPageMngr = EditorUtils.getIPageMngr();
+ IPageMngr iPageMngr = ServiceUtilsForEObject.getInstance().getIPageMngr(model);
Object[] result = iPageMngr.allPages().toArray();
List<Object> res = new ArrayList<Object>();
for(Object current : result) {
- if(current != null /* && current instanceof PapyrusTableInstance */) {
-// if the model is a little bit corrupted, we can have a null element in the list
- res.add(current);
+ if(current != null /* && current instanceof PapyrusTableInstance */) {
+ // if the model is a little bit corrupted, we can have a null element in the list
+ res.add(current);
}
}
return res.toArray();
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
index 9a9eda9235f..14f141e322b 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkFilteredLabelProvider.java
@@ -12,7 +12,7 @@
package org.eclipse.papyrus.infra.hyperlink.util;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
public class HyperLinkFilteredLabelProvider extends HyperLinkLabelProvider implements IFilteredLabelProvider {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
index ed7cfd2ebea..82d73a88f70 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusControlAction.java
@@ -28,6 +28,7 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -37,7 +38,6 @@ import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.services.controlmode.commands.ControlCommand;
import org.eclipse.papyrus.infra.services.controlmode.util.ControlModeUtil;
@@ -127,6 +127,7 @@ public class PapyrusControlAction extends ControlAction {
/**
* {@inheritDoc}
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
@Override
public void run() {
// check if object selection is in the current model set. If not, warn the user and disable action
@@ -154,7 +155,7 @@ public class PapyrusControlAction extends ControlAction {
return;
}
try {
- ControlCommand transactionalCommand = new ControlCommand(EditorUtils.getTransactionalEditingDomain(), controlledModel, eObject, "Control", null);
+ ControlCommand transactionalCommand = new ControlCommand((TransactionalEditingDomain)getEditingDomain(), controlledModel, eObject, "Control", null);
IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if(status.isOK()) {
notifySave();
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
index 954d398e8e5..a53c73b3f06 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/action/PapyrusUncontrolAction.java
@@ -23,13 +23,13 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.action.CommandActionHandler;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.UncontrolCommand;
import org.eclipse.papyrus.infra.services.controlmode.util.ControlModeUtil;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
@@ -103,6 +103,7 @@ public class PapyrusUncontrolAction extends CommandActionHandler {
/**
* {@inheritDoc}
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
@Override
public void run() {
// check if the uncontrol is made from the parent resource. If not, warn the user and disable action
@@ -119,7 +120,7 @@ public class PapyrusUncontrolAction extends CommandActionHandler {
try {
boolean confirmDelete = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Delete controlled resources?", "Delete the original controlled files ?");
- UncontrolCommand transactionalCommand = new UncontrolCommand(EditorUtils.getTransactionalEditingDomain(), eObject, "Uncontrol", null, confirmDelete);
+ UncontrolCommand transactionalCommand = new UncontrolCommand((TransactionalEditingDomain)getEditingDomain(), eObject, "Uncontrol", null, confirmDelete);
IStatus status = CheckedOperationHistory.getInstance().execute(transactionalCommand, new NullProgressMonitor(), null);
if(!status.isOK()) {
NotificationBuilder.createErrorPopup(status.getMessage()).setTitle("Unable to uncontrol").run();
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
index d3912d92a5c..b92e6808210 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/ControlCommand.java
@@ -48,6 +48,7 @@ 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.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.commands.Activator;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.modelsetquery.ModelSetQuery;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -57,7 +58,8 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
import org.eclipse.papyrus.infra.core.sashwindows.di.exception.SashEditorException;
import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.IControlCommand.STATE_CONTROL;
@@ -115,8 +117,14 @@ public class ControlCommand extends AbstractTransactionalCommand {
addContext(new EditingDomainUndoContext(domain));
ResourceSet set = domain.getResourceSet();
- if (set instanceof ModelSet) {
- modelSet = (ModelSet) set;
+ if(set instanceof ModelSet) {
+ modelSet = (ModelSet)set;
+ } else {
+ try {
+ modelSet = ServiceUtilsForResource.getInstance().getModelSet(model);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
}
@@ -128,13 +136,11 @@ public class ControlCommand extends AbstractTransactionalCommand {
commands = getCommandExtensions();
IStatus status = doRedo(monitor, info);
CommandResult result;
- if (status.equals(Status.OK_STATUS)) {
- result = CommandResult.newOKCommandResult();
- }
- else if (status.equals(Status.CANCEL_STATUS)) {
+ if(status.equals(Status.OK_STATUS)) {
+ result = CommandResult.newOKCommandResult();
+ } else if(status.equals(Status.CANCEL_STATUS)) {
result = CommandResult.newErrorCommandResult("Unable to execute control command");
- }
- else {
+ } else {
result = CommandResult.newCancelledCommandResult();
}
return result;
@@ -156,10 +162,6 @@ public class ControlCommand extends AbstractTransactionalCommand {
*/
@Override
protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (modelSet == null) {
- modelSet = EditorUtils.getDiResourceSet();
- }
-
// Create the URI from models that will be created
final URI newNotationURI = URI.createURI(controlledModel.getURI().trimFileExtension().appendFileExtension(NotationModel.NOTATION_FILE_EXTENSION).toString());
this.controlledNotation = getResource(newNotationURI);
@@ -453,7 +455,7 @@ public class ControlCommand extends AbstractTransactionalCommand {
* @param parentURIFullPath
*/
protected void assignToChildExistingControledResources(EditingDomain domain, CompoundCommand compoundCommand, ControledResource child, String controledResourceURL, List<ControledResource> controledFromParent, String parentURL, URI controledURIFullPath, URI parentURIFullPath) {
- for(ControledResource r : controledFromParent) {
+ for(ControledResource r : controledFromParent) {
if(r.getResourceURL() != null) {
URI fullPathParent = URI.createURI(r.getResourceURL()).resolve(parentURIFullPath);
Resource resourceLoaded = modelSet.getResource(fullPathParent, false);
@@ -573,8 +575,8 @@ public class ControlCommand extends AbstractTransactionalCommand {
* @return
*/
protected Resource getHistoryResource(EObject eObject) {
- if (eObject.eResource() != null) {
- return modelSet.getResource(eObject.eResource().getURI().trimFileExtension().appendFileExtension(HistoryModel.MODEL_FILE_EXTENSION), true);
+ if(eObject.eResource() != null) {
+ return modelSet.getResource(eObject.eResource().getURI().trimFileExtension().appendFileExtension(HistoryModel.MODEL_FILE_EXTENSION), true);
}
return null;
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
index 4bbead67c09..5329e18168f 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/UncontrolCommand.java
@@ -52,11 +52,13 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.commands.Activator;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModelUtils;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.controlmode.commands.IUncontrolCommand.STATE_CONTROL;
@@ -118,7 +120,8 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
* @param label
* @param affectedFiles
* @param selectedObject
- * @param deleteUncontrolledResources whether to delete uncontrolled resources
+ * @param deleteUncontrolledResources
+ * whether to delete uncontrolled resources
*/
public UncontrolCommand(TransactionalEditingDomain domain, EObject selectedObject, String label, List<?> affectedFiles, boolean deleteUncontrolledResources) {
super(domain, label, affectedFiles);
@@ -128,10 +131,16 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
controlledResourceToRemove = new LinkedList<ControledResource>();
addedControlledResource = new LinkedList<ControledResource>();
deleteResources = deleteUncontrolledResources;
-
+
ResourceSet set = domain.getResourceSet();
- if (set instanceof ModelSet) {
- modelSet = (ModelSet) set;
+ if(set instanceof ModelSet) {
+ modelSet = (ModelSet)set;
+ } else {
+ try {
+ modelSet = ServiceUtilsForEObject.getInstance().getModelSet(selectedObject);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
}
}
@@ -143,13 +152,11 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
commands = getCommandExtensions();
IStatus status = doRedo(monitor, info);
CommandResult result;
- if (status.equals(Status.OK_STATUS)) {
- result = CommandResult.newOKCommandResult();
- }
- else if (status.equals(Status.CANCEL_STATUS)) {
+ if(status.equals(Status.OK_STATUS)) {
+ result = CommandResult.newOKCommandResult();
+ } else if(status.equals(Status.CANCEL_STATUS)) {
result = CommandResult.newErrorCommandResult("Unable to execute uncontrol command");
- }
- else {
+ } else {
result = CommandResult.newCancelledCommandResult();
}
return result;
@@ -179,10 +186,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
final URI newDiURI = URI.createURI(controlledModel.getURI().trimFileExtension().appendFileExtension(DiModel.DI_FILE_EXTENSION).toString());
this.controlledDI = getEditingDomain().getResourceSet().getResource(newDiURI, true);
}
- if (modelSet == null) {
- modelSet = EditorUtils.getDiResourceSet();
- }
-
+
CompoundCommand compoundCommand = new CompoundCommand();
uncontrolNotation(compoundCommand);
uncontrolModel(compoundCommand);
@@ -258,9 +262,9 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
for(Diagram diag : controlledDiagrams) {
uncontrol(getEditingDomain(), diag, controlledNotation, notationResource, compoundCommand, STATE_CONTROL.POST_NOTATION);
}
-
+
//uncontrol for PapyrusTable
- uncontrol(getEditingDomain(),eObject, controlledNotation, notationResource,compoundCommand, STATE_CONTROL.POST_NOTATION);
+ uncontrol(getEditingDomain(), eObject, controlledNotation, notationResource, compoundCommand, STATE_CONTROL.POST_NOTATION);
}
}
@@ -281,7 +285,7 @@ public class UncontrolCommand extends AbstractTransactionalCommand {
newURL = HistoryUtils.resolve(uriPath, newURL);
oldURL = HistoryUtils.resolve(uriPath, oldURL);
Set<ControledResource> controledOldURL = new HashSet<ControledResource>(HistoryUtils.getControledResourcesForURL(modelSet, oldURL));
- controledOldURL.addAll(HistoryUtils.getControledResourcesForURL(modelSet, oldURL.substring(oldURL.lastIndexOf("/")+1,oldURL.length())));
+ controledOldURL.addAll(HistoryUtils.getControledResourcesForURL(modelSet, oldURL.substring(oldURL.lastIndexOf("/") + 1, oldURL.length())));
List<ControledResource> controledNewURL = HistoryUtils.getControledResourcesForURL(modelSet, newURL);
for(ControledResource resourceOldURL : controledOldURL) {
if(resourceOldURL.getChildren().isEmpty()) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
index 1c9b7d79b8b..f0b667b5904 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/DecorationService.java
@@ -13,13 +13,13 @@
package org.eclipse.papyrus.infra.services.decoration;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -192,8 +192,7 @@ public class DecorationService extends Observable implements IDecorationService
ImageDescriptor imageForME = infoUtil.getImageDescriptorForME(marker);
PreferedPosition position = infoUtil.getPreferedPosition(marker);
int priority = infoUtil.getPriority(marker);
- IPapyrusDecoration decoration =
- addDecoration(marker.toString(), marker.getType(), element, imageForGE, imageForME, position, infoUtil.getMessage(marker), priority);
+ IPapyrusDecoration decoration = addDecoration(marker.toString(), marker.getType(), element, imageForGE, imageForME, position, infoUtil.getMessage(marker), priority);
return decoration;
}
@@ -217,8 +216,8 @@ public class DecorationService extends Observable implements IDecorationService
* the decoration
* @param message
* the message
- * @param priority
- * the priority
+ * @param priority
+ * the priority
* @see org.eclipse.papyrus.infra.services.decoration.IDecorationService#addDecoration(java.lang.String, org.eclipse.emf.ecore.EObject,
* org.eclipse.jface.resource.ImageDescriptor, java.lang.String)
*/
@@ -228,8 +227,7 @@ public class DecorationService extends Observable implements IDecorationService
if(decoration == null) {
decoration = new Decoration(id, type, decorationImageForGE, decorationImageForME, message, element, priority);
decorations.put(id, decoration);
- }
- else {
+ } else {
decoration.setDecorationImageForGE(decorationImageForGE);
decoration.setDecorationImageForME(decorationImageForME);
decoration.setMessage(message);
@@ -251,7 +249,7 @@ public class DecorationService extends Observable implements IDecorationService
* @return the decoration
* @see org.eclipse.papyrus.infra.services.decoration.IDecorationService#getDecoration(java.lang.Object, boolean)
*/
- public EList<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents) {
+ public List<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents) {
DecorationUtils tool = new DecorationUtils(element);
tool.tryChildIfEmpty();
if(tool.getEObject() != null) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
index 98233257e1c..5502c2eb696 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/IDecorationService.java
@@ -12,9 +12,9 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.services.decoration;
+import java.util.List;
import java.util.Observer;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.services.IService;
@@ -106,5 +106,5 @@ public interface IDecorationService extends IService {
* the navigate to parents
* @return the decoration
*/
- EList<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents);
+ List<IPapyrusDecoration> getDecorations(Object element, boolean navigateToParents);
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
index 8c55b7e092b..6eaee24ab8d 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
@@ -14,7 +14,8 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.services.decoration.util;
-import org.eclipse.emf.common.util.EList;
+import java.util.List;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IDecoration;
@@ -257,7 +258,7 @@ public class Decoration implements IPapyrusDecoration {
}
}
- public static String getMessageFromDecorations(EList<IPapyrusDecoration> decorations) {
+ public static String getMessageFromDecorations(List<IPapyrusDecoration> decorations) {
String message = "";
if(decorations != null) {
for(IPapyrusDecoration decoration : decorations) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
index 52de8310ac5..e2ff4eb6f53 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.preferences/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf;bundle-version="2.6.0",
org.eclipse.emf.common.ui;bundle-version="2.7.0",
org.eclipse.emf.common;bundle-version="2.8.0",
- org.eclipse.core.resources;bundle-version="3.8.1",
+ org.eclipse.core.resources;bundle-version="3.8.0",
org.eclipse.gef;bundle-version="3.8.1",
org.eclipse.emf.ecore,
org.eclipse.papyrus.infra.services.resourceloading;bundle-version="0.10.0"
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
index 26d15080700..f551bc27ecd 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
@@ -49,8 +49,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -58,7 +56,6 @@ import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.table.common.Activator;
@@ -368,22 +365,13 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
}
/**
- * Get the current MultiDiagramEditor.
- *
- * @return
- * @throws BackboneException
- */
- protected IMultiDiagramEditor getMultiDiagramEditor() throws BackboneException {
- return EditorUtils.getMultiDiagramEditorChecked();
- }
-
- /**
* Returns the context used to create the table
*
* @return
* the context used to create the table or <code>null</code> if not found
* @throws ServiceException
*/
+ //FIXME: This method introduces a dependency to UML. Use the semantic service instead.
protected EObject getTableContext() {
List<EObject> selection = getSelection();
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
index b8e0eec2788..8f474a2549a 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/providers/FilteredTableLabelProvider.java
@@ -13,8 +13,8 @@ package org.eclipse.papyrus.infra.table.common.providers;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
/**
* A Filter Label Provider for {@link PapyrusTableInstance}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
index 010338a069e..c0a41845d41 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.infra.table.modelexplorer.queries;
import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
@@ -27,6 +26,6 @@ public class GetTableIcon extends AbstractGetEditorIconQuery implements IJavaMod
* {@inheritDoc}
*/
public String evaluate(final PapyrusTableInstance context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
index bebf29e5e18..99b06bbf09d 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
@@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
index 28c058ce1b9..9f57ecb282b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
@@ -15,11 +15,10 @@ package org.eclipse.papyrus.sysml.diagram.common.utils;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection;
import org.eclipse.papyrus.sysml.SysmlPackage;
import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
import org.eclipse.papyrus.sysml.diagram.common.Activator;
@@ -39,13 +38,13 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class SysMLSelectionTester extends PropertyTester {
/** Tester ID for SysML Model nature. This is currently a test on: is this a blocks profiles package... */
- public final static String IS_SYSML_MODEL = "isSysMLModel"; //$NON-NLS-N$
-
+ public final static String IS_SYSML_MODEL = "isSysMLModel";
+
/** Tester ID for SysML Requirements Model nature */
- public final static String IS_SYSML_REQUIREMENTS_MODEL = "isSysMLRequirementsModel"; //$NON-NLS-N$
-
+ public final static String IS_SYSML_REQUIREMENTS_MODEL = "isSysMLRequirementsModel";
+
/** Tester ID for SysML Blocks Model nature */
- public final static String IS_SYSML_BLOCKS_MODEL = "isSysMLBlocksModel"; //$NON-NLS-N$
+ public final static String IS_SYSML_BLOCKS_MODEL = "isSysMLBlocksModel";
/** Default constructor */
public SysMLSelectionTester() {
@@ -55,15 +54,11 @@ public class SysMLSelectionTester extends PropertyTester {
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
// Ensure Papyrus is the active editor
- IMultiDiagramEditor editor = EditorUtils.getMultiDiagramEditor();
- if(editor == null) {
- return false;
- }
Object currentValue = null;
if(IS_SYSML_MODEL.equals(property)) {
currentValue = testSysMLModelNature(receiver);
return (currentValue == expectedValue);
- } else if(IS_SYSML_BLOCKS_MODEL.equals(property)) {
+ } else if(IS_SYSML_BLOCKS_MODEL.equals(property)) {
currentValue = testSysMLBlocksModelNature(receiver);
return (currentValue == expectedValue);
} else if(IS_SYSML_REQUIREMENTS_MODEL.equals(property)) {
@@ -78,9 +73,9 @@ public class SysMLSelectionTester extends PropertyTester {
protected boolean testSysMLModelNature(Object receiver) {
boolean isSysMLModel = false;
- EObject root = getRoot();
+ EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
+ Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
if(((Package)root).isProfileApplied(sysml)) {
isSysMLModel = true;
}
@@ -88,14 +83,14 @@ public class SysMLSelectionTester extends PropertyTester {
return isSysMLModel;
}
-
+
/** True is root object is a UML Model with SysML Requirements Profile applied */
protected boolean testSysMLRequirementsModelNature(Object receiver) {
boolean isSysMLModel = false;
- EObject root = getRoot();
+ EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
+ Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
if(((Package)root).isProfileApplied(sysml)) {
isSysMLModel = true;
}
@@ -103,14 +98,14 @@ public class SysMLSelectionTester extends PropertyTester {
return isSysMLModel;
}
-
+
/** True is root object is a UML Model with SysML Blocks Profile applied */
protected boolean testSysMLBlocksModelNature(Object receiver) {
boolean isSysMLModel = false;
- EObject root = getRoot();
+ EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
+ Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
if(((Package)root).isProfileApplied(sysml)) {
isSysMLModel = true;
}
@@ -118,21 +113,28 @@ public class SysMLSelectionTester extends PropertyTester {
return isSysMLModel;
}
-
+
/** Returns the root EObject of currently opened model */
- private EObject getRoot() {
+ private EObject getRoot(Object receiver) {
EObject root = null;
- try {
- ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
- UmlModel openedModel = (UmlModel)serviceUtils.getModelSet().getModel(UmlModel.MODEL_ID);
- if(openedModel != null) {
- root = openedModel.lookupRoot();
+ if(receiver instanceof ISelection) {
+ ISelection selection = (ISelection)receiver;
+ if(selection.isEmpty()) {
+ return null;
+ }
+
+ try {
+ ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance();
+ UmlModel openedModel = (UmlModel)serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID);
+ if(openedModel != null) {
+ root = openedModel.lookupRoot();
+ }
+ } catch (ServiceException e) {
+ //Ignored: The selection cannot be used to retrieve the ServicesRegistry
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
}
- } catch (ServiceException e) {
- Activator.log.error(e);
- } catch (NotFoundException e) {
- Activator.log.error(e);
}
return root;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
index 73ea841958a..18a3f673d48 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
@@ -27,7 +27,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock,
org.eclipse.papyrus.sysml.diagram.internalblock.compatibility,
org.eclipse.papyrus.sysml.diagram.internalblock.dnd.helper,
diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/handler/AbstractCommandHandler.java b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/handler/AbstractCommandHandler.java
index f5d56f453e6..eb742efadc2 100644
--- a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/handler/AbstractCommandHandler.java
+++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/handler/AbstractCommandHandler.java
@@ -219,7 +219,7 @@ public abstract class AbstractCommandHandler extends AbstractHandler {
try {
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers util = ServiceUtilsForActionHandlers.getInstance();
creationcommand = getCommand();
util.getTransactionalEditingDomain().getCommandStack().execute(creationcommand);
@@ -241,6 +241,7 @@ public abstract class AbstractCommandHandler extends AbstractHandler {
*
* @return true (enabled) when the command can be executed.
*/
+ @Override
public boolean isEnabled() {
return getCommand().canExecute();
}
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
index 9760cd9fd88..8c89ac18f9e 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.xtext,
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.emf.transaction;bundle-version="1.4.0",
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
- org.eclipse.jface;bundle-version="3.8.0"
+ org.eclipse.jface;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.alf,
org.eclipse.papyrus.uml.alf.alf,
org.eclipse.papyrus.uml.alf.alf.impl,
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
index 1cfb34f661d..bad809bac63 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
@@ -29,10 +29,12 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+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.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.alf.alf.AcceptBlock;
import org.eclipse.papyrus.uml.alf.alf.AcceptStatement;
import org.eclipse.papyrus.uml.alf.alf.AlfPackage;
@@ -88,25 +90,28 @@ import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.xtext.validation.Check;
import org.eclipse.xtext.validation.EValidatorRegistrar;
-
+
public class AlfJavaValidator extends AbstractAlfJavaValidator {
-
- private static Element contextElement ;
- private static Classifier contextClassifier ;
- private static Namespace model ;
-
- private static Package alfStandardLibrary ; // TODO: include the library as part of the plug-in
- public static PredefinedBehaviorsAndTypesUtils predefinedBehaviorsAndTypes ;
-
+
+ private static Element contextElement;
+
+ private static Classifier contextClassifier;
+
+ private static Namespace model;
+
+ private static Package alfStandardLibrary; // TODO: include the library as part of the plug-in
+
+ public static PredefinedBehaviorsAndTypesUtils predefinedBehaviorsAndTypes;
+
public static Package getAlfStandardLibrary() {
- return alfStandardLibrary;
+ return alfStandardLibrary;
}
public static boolean validate() {
- return true ;
+ return true;
}
-
+
public static Namespace getModel() {
return model;
}
@@ -114,71 +119,62 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
public static void setModel(Namespace model) {
AlfJavaValidator.model = model;
}
-
+
public static void setContextElement(Element _contextElement) {
- contextElement = _contextElement ;
+ contextElement = _contextElement;
}
-
+
public static Element getContextElement() {
- return contextElement ;
+ return contextElement;
}
-
+
public static Classifier getContextClassifier() {
- return contextClassifier ;
+ return contextClassifier;
}
-
+
public static void setContextClassifier(Classifier contextClassifier) {
- AlfJavaValidator.contextClassifier = contextClassifier ;
- alfStandardLibrary = null ;
+ AlfJavaValidator.contextClassifier = contextClassifier;
+ alfStandardLibrary = null;
//if (alfStandardLibrary == null) {
- for (PackageImport pImport : contextClassifier.getModel().getPackageImports()) {
- Package p = pImport.getImportedPackage() ;
- if (p.getQualifiedName().equals("Alf")) {
- //alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
- alfStandardLibrary = (Package)p ;
- }
+ for(PackageImport pImport : contextClassifier.getModel().getPackageImports()) {
+ Package p = pImport.getImportedPackage();
+ if(p.getQualifiedName().equals("Alf")) {
+ //alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
+ alfStandardLibrary = p;
}
- //}
- if (alfStandardLibrary != null) {
- predefinedBehaviorsAndTypes = new PredefinedBehaviorsAndTypesUtils() ;
- predefinedBehaviorsAndTypes.init(alfStandardLibrary) ;
}
- else {
-
- String question = "The context model " +
- contextClassifier.getModel().getName() +
- " does not import the standard Alf library. This import is required for static validation of Alf expressions and statements. \n\n Do you want to generate this import?" ;
- boolean doGenerateImport = MessageDialog.openQuestion(
- new Shell(),
- "Alf editor",
- question);
- if (doGenerateImport) {
- RegisteredLibrary[] libraries = RegisteredLibrary.getRegisteredLibraries() ;
- RegisteredLibrary alfLibrary = null ;
- for (RegisteredLibrary l : libraries) {
- if (l.getName().equals("AlfLibrary"))
- alfLibrary = l ;
+ //}
+ if(alfStandardLibrary != null) {
+ predefinedBehaviorsAndTypes = new PredefinedBehaviorsAndTypesUtils();
+ predefinedBehaviorsAndTypes.init(alfStandardLibrary);
+ } else {
+
+ String question = "The context model " + contextClassifier.getModel().getName() + " does not import the standard Alf library. This import is required for static validation of Alf expressions and statements. \n\n Do you want to generate this import?";
+ boolean doGenerateImport = MessageDialog.openQuestion(new Shell(), "Alf editor", question);
+ if(doGenerateImport) {
+ RegisteredLibrary[] libraries = RegisteredLibrary.getRegisteredLibraries();
+ RegisteredLibrary alfLibrary = null;
+ for(RegisteredLibrary l : libraries) {
+ if(l.getName().equals("AlfLibrary")) {
+ alfLibrary = l;
+ }
}
- if (alfLibrary != null) {
+ if(alfLibrary != null) {
// Creates and executes the update command
UpdateImportCommand updateCommand = new UpdateImportCommand(contextClassifier.getModel(), alfLibrary);
try {
OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- setContextClassifier(contextClassifier) ;
+ setContextClassifier(contextClassifier);
} catch (ExecutionException e) {
System.err.println(e);
}
- }
- else {
- MessageDialog.openError(
- new Shell(),
- "Alf editor",
- "Could not find standard Alf library") ;
+ } else {
+ MessageDialog.openError(new Shell(), "Alf editor", "Could not find standard Alf library");
}
}
}
}
-
+
/**
* @author CEA LIST
*
@@ -187,7 +183,8 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
protected static class UpdateImportCommand extends AbstractTransactionalCommand {
private Model model;
- private RegisteredLibrary library ;
+
+ private RegisteredLibrary library;
/*
* (non-Javadoc)
@@ -199,1227 +196,1184 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
URI libraryUri = library.uri;
- ResourceSet resourceSet = Util.getResourceSet(contextClassifier) ;
- Resource libraryResource = resourceSet.getResource(libraryUri, true) ;
- Package libraryObject = (Package)libraryResource.getContents().get(0) ;
- model.createPackageImport(libraryObject) ;
+ ResourceSet resourceSet = Util.getResourceSet(contextClassifier);
+ Resource libraryResource = resourceSet.getResource(libraryUri, true);
+ Package libraryObject = (Package)libraryResource.getContents().get(0);
+ model.createPackageImport(libraryObject);
return CommandResult.newOKCommandResult(model);
}
public UpdateImportCommand(Model model, RegisteredLibrary library) {
- super(EditorUtils.getTransactionalEditingDomain(), "Model Update", getWorkspaceFiles(model));
- this.model = model ;
- this.library = library ;
+ super(getTransactionalEditingDomain(model), "Model Update", getWorkspaceFiles(model));
+ this.model = model;
+ this.library = library;
//this.operation = operation;
}
+
+ private static TransactionalEditingDomain getTransactionalEditingDomain(Model model) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(model);
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.err);
+ return null;
+ }
+ }
}
-
+
@Override
public void register(EValidatorRegistrar registrar) {
// alf validator is not registered for a specific language
- super.register(registrar) ;
+ super.register(registrar);
}
-
+
/**
* @param tupleElement
*
- * Checks the following rule:
- * 1. the expression associated with the tuple must not encapsulate any error
+ * Checks the following rule:
+ * 1. the expression associated with the tuple must not encapsulate any error
*/
@Check
public void checkTupleElement(TupleElement tupleElement) {
- TypeExpression exp = new TypeUtils().getTypeOfExpression(tupleElement.getArgument()) ;
- if (exp.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)exp.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
+ TypeExpression exp = new TypeUtils().getTypeOfExpression(tupleElement.getArgument());
+ if(exp.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)exp.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
}
}
-
+
/**
- * @param statement LocalNameDeclarationStatement
- *
- * Checks the following rules:
- * 1. the local variable name must be available
- * 2. the type must be resolved
- * 3. the init expression must be type/multiplicity compatible with the variable type
+ * @param statement
+ * LocalNameDeclarationStatement
+ *
+ * Checks the following rules:
+ * 1. the local variable name must be available
+ * 2. the type must be resolved
+ * 3. the init expression must be type/multiplicity compatible with the variable type
*/
@Check
public void checkLocalNameDeclarationStatement(LocalNameDeclarationStatement statement) {
// 1. checks that the local variable name is available
- if (statement.getVarName() != null) {
- AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- List<EObject> resolved = variablesScope.resolveByName(statement.getVarName()) ;
- if (! resolved.isEmpty()) {// name is already used
+ if(statement.getVarName() != null) {
+ AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ List<EObject> resolved = variablesScope.resolveByName(statement.getVarName());
+ if(!resolved.isEmpty()) {// name is already used
// needs to determine if the scoping level where it is used is conflicting (i.e., it is in the first scoping level)
- if (variablesScope.getScopingLevel(resolved.get(0)) == 0 && resolved.get(0) != statement) {
+ if(variablesScope.getScopingLevel(resolved.get(0)) == 0 && resolved.get(0) != statement) {
// There is a name conflict
- error("Local name " + statement.getVarName() + " is not available" , AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName()) ;
+ error("Local name " + statement.getVarName() + " is not available", AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName());
}
}
}
-
+
// 2. checks that type can be resolved, and that potentially required template bindings are specified
- TypeFacade variableType = null ;
- if (statement.getType() != null) {
- variableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getType()) ;
- if (variableType instanceof ErrorTypeFacade) { // Type could not be resolved
- ErrorTypeFacade error = (ErrorTypeFacade)variableType ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- variableType = null ;
- }
- else if (variableType.isATemplate()){
- if (statement.getType().getBinding() == null) {
- String errorMessage = variableType.getLabel() + " is a template. All its parameters shall be bound." ;
- error(errorMessage, statement, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Type(), INSIGNIFICANT_INDEX) ;
+ TypeFacade variableType = null;
+ if(statement.getType() != null) {
+ variableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getType());
+ if(variableType instanceof ErrorTypeFacade) { // Type could not be resolved
+ ErrorTypeFacade error = (ErrorTypeFacade)variableType;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ variableType = null;
+ } else if(variableType.isATemplate()) {
+ if(statement.getType().getBinding() == null) {
+ String errorMessage = variableType.getLabel() + " is a template. All its parameters shall be bound.";
+ error(errorMessage, statement, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Type(), INSIGNIFICANT_INDEX);
}
}
}
-
+
// 3. checks the init expression
- if (statement.getInit() != null) {
- TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(statement.getInit()) ;
+ if(statement.getInit() != null) {
+ TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(statement.getInit());
// first checks that init expression is valid
- if (typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
+ if(typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
// Type expression is valid
// In the case where type has been validated at step 2., checks if the type of init expression is compatible with variable type
- if (variableType != null) {
- int lowerBound = statement.isMultiplicityIndicator() ? 0 : 1 ;
- int upperBound = statement.isMultiplicityIndicator() ? -1 : 1 ;
- boolean isUnique = statement.isMultiplicityIndicator() ? false : true ;
- boolean isOrdered = statement.isMultiplicityIndicator() ? true : false ;
- TypeExpression expectedType = TypeExpressionFactory.eInstance.createTypeExpression(variableType, lowerBound, upperBound, isUnique, isOrdered) ;
- if (expectedType.isCompatibleWithMe(typeOfInit) == 0) {
- error("Found an expression of type " + typeOfInit.getLabel() + ". Expecting an expression of type " + expectedType.getLabel(), AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Init()) ;
+ if(variableType != null) {
+ int lowerBound = statement.isMultiplicityIndicator() ? 0 : 1;
+ int upperBound = statement.isMultiplicityIndicator() ? -1 : 1;
+ boolean isUnique = statement.isMultiplicityIndicator() ? false : true;
+ boolean isOrdered = statement.isMultiplicityIndicator() ? true : false;
+ TypeExpression expectedType = TypeExpressionFactory.eInstance.createTypeExpression(variableType, lowerBound, upperBound, isUnique, isOrdered);
+ if(expectedType.isCompatibleWithMe(typeOfInit) == 0) {
+ error("Found an expression of type " + typeOfInit.getLabel() + ". Expecting an expression of type " + expectedType.getLabel(), AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Init());
}
}
}
}
}
-
+
/**
- * @param statement IfStatement
+ * @param statement
+ * IfStatement
*
- * Checks the following rule:
- * 1. The condition associated with each clause must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with each clause must be a boolean expression
*/
@Check
public void checkIfStatement(IfStatement statement) {
- for (ConcurrentClauses concurrentClause : statement.getSequentialClausses().getConccurentClauses()) {
- for (NonFinalClause nonFinalClause : concurrentClause.getNonFinalClause()) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(nonFinalClause.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, nonFinalClause, AlfPackage.eINSTANCE.getNonFinalClause_Condition(), INSIGNIFICANT_INDEX) ;
+ for(ConcurrentClauses concurrentClause : statement.getSequentialClausses().getConccurentClauses()) {
+ for(NonFinalClause nonFinalClause : concurrentClause.getNonFinalClause()) {
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(nonFinalClause.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, nonFinalClause, AlfPackage.eINSTANCE.getNonFinalClause_Condition(), INSIGNIFICANT_INDEX);
}
}
}
}
}
-
+
/**
- * @param statement WhileStatement
+ * @param statement
+ * WhileStatement
*
- * Checks the following rule:
- * 1. The condition associated with the while must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with the while must be a boolean expression
*/
@Check
public void checkWhileStatement(WhileStatement statement) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getWhileStatement_Condition()) ;
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getWhileStatement_Condition());
}
}
}
-
+
/**
- * @param statement DoStatement
+ * @param statement
+ * DoStatement
*
- * Checks the following rule:
- * 1. The condition associated with the DoStatement must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with the DoStatement must be a boolean expression
*/
@Check
public void checkDoStatement(DoStatement statement) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getDoStatement_Condition()) ;
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getDoStatement_Condition());
}
}
}
-
+
/**
- * @param statement ForStatement
+ * @param statement
+ * ForStatement
*
- * Checks the following rule:
- * 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
- * 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
- * 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
- * 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
- * 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other constraints in the spec)
- * 4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
- * 4.a. type must be resolved
- * 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
+ * Checks the following rule:
+ * 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
+ * 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
+ * 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
+ * 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
+ * 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other
+ * constraints in the spec)
+ * 4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
+ * 4.a. type must be resolved
+ * 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
*/
@Check
public void checkForStatement(ForStatement statement) {
// 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
- AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- Map<String, Integer> declaredVariables = new HashMap<String, Integer>() ;
- for (LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
- Integer variableDefinitionCounter = declaredVariables.get(loopVariable.getName()) ;
- if (variableDefinitionCounter == null) {
- declaredVariables.put(loopVariable.getName(), new Integer(1)) ;
- }
- else {
- declaredVariables.put(loopVariable.getName(), variableDefinitionCounter.intValue() + 1) ;
+ AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ Map<String, Integer> declaredVariables = new HashMap<String, Integer>();
+ for(LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
+ Integer variableDefinitionCounter = declaredVariables.get(loopVariable.getName());
+ if(variableDefinitionCounter == null) {
+ declaredVariables.put(loopVariable.getName(), new Integer(1));
+ } else {
+ declaredVariables.put(loopVariable.getName(), variableDefinitionCounter.intValue() + 1);
}
- List<EObject> visibleVariables = variablesScope.resolveByName(loopVariable.getName()) ;
- if (! visibleVariables.isEmpty()) { // potentially conflicting name
- if (variablesScope.getScopingLevel(visibleVariables.get(0)) == 0) {
+ List<EObject> visibleVariables = variablesScope.resolveByName(loopVariable.getName());
+ if(!visibleVariables.isEmpty()) { // potentially conflicting name
+ if(variablesScope.getScopingLevel(visibleVariables.get(0)) == 0) {
// There is actually a conflict
- error("Local name " + loopVariable.getName() + " is not available" ,
- loopVariable,
- AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName(),
- statement.getControl().getLoopVariableDefinition().indexOf(loopVariable)) ;
+ error("Local name " + loopVariable.getName() + " is not available", loopVariable, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName(), statement.getControl().getLoopVariableDefinition().indexOf(loopVariable));
}
}
}
-
+
// 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
- boolean duplicationFound = false ;
- for (Integer i : declaredVariables.values()) {
- if (i.intValue() > 1)
- duplicationFound = true ;
+ boolean duplicationFound = false;
+ for(Integer i : declaredVariables.values()) {
+ if(i.intValue() > 1) {
+ duplicationFound = true;
+ }
}
- if (duplicationFound) {
- error("Duplicate loop variable definitions" , AlfPackage.eINSTANCE.getForStatement_Control()) ;
+ if(duplicationFound) {
+ error("Duplicate loop variable definitions", AlfPackage.eINSTANCE.getForStatement_Control());
}
-
- for (LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
+
+ for(LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
// 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
// 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
- if (loopVariable.getExpression1() != null && loopVariable.getExpression2() == null) {
- TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1()) ;
- if (typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- int upperBound = typeOfExpression1.getMultiplicity().getUpperBound() ;
- if (! (upperBound > 1 || upperBound == -1)) {
- String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected." ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX) ;
+ if(loopVariable.getExpression1() != null && loopVariable.getExpression2() == null) {
+ TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1());
+ if(typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ int upperBound = typeOfExpression1.getMultiplicity().getUpperBound();
+ if(!(upperBound > 1 || upperBound == -1)) {
+ String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected.";
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX);
}
}
}
// 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other constraints in the spec)
- else if (loopVariable.getExpression1() != null && loopVariable.getExpression2() != null) {
- TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1()) ;
- boolean errorInExpressions = false ;
- if (typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ else if(loopVariable.getExpression1() != null && loopVariable.getExpression2() != null) {
+ TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1());
+ boolean errorInExpressions = false;
+ if(typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
- TypeExpression typeOfExpression2 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression2()) ;
- if (typeOfExpression2.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression2.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfExpression2 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression2());
+ if(typeOfExpression2.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression2.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
- if (! errorInExpressions) { // both Expression must be type compatible and resolve to a scalar number value
- TypeFacade typeFacadeOfExpression1 = typeOfExpression1.getTypeFacade() ;
- int upperBoundExpression1 = typeOfExpression1.getMultiplicityFacade().getUpperBound() ;
- String errorMessageForExpression1 = "" ;
- if (!isANumberType(typeFacadeOfExpression1)) {
- if (upperBoundExpression1 > 1 || upperBoundExpression1 == -1)
- errorMessageForExpression1 += "A scalar number value is expected" ;
- else
- errorMessageForExpression1 += "A number value is expected" ;
- }
- else {
- if (upperBoundExpression1 > 1 || upperBoundExpression1 == -1)
- errorMessageForExpression1 += "A scalar value is expected" ;
- }
- if (!(errorMessageForExpression1.length() == 0)) {
- error(errorMessageForExpression1, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX) ;
+ if(!errorInExpressions) { // both Expression must be type compatible and resolve to a scalar number value
+ TypeFacade typeFacadeOfExpression1 = typeOfExpression1.getTypeFacade();
+ int upperBoundExpression1 = typeOfExpression1.getMultiplicityFacade().getUpperBound();
+ String errorMessageForExpression1 = "";
+ if(!isANumberType(typeFacadeOfExpression1)) {
+ if(upperBoundExpression1 > 1 || upperBoundExpression1 == -1) {
+ errorMessageForExpression1 += "A scalar number value is expected";
+ } else {
+ errorMessageForExpression1 += "A number value is expected";
+ }
+ } else {
+ if(upperBoundExpression1 > 1 || upperBoundExpression1 == -1) {
+ errorMessageForExpression1 += "A scalar value is expected";
+ }
}
- TypeFacade typeFacadeOfExpression2 = typeOfExpression2.getTypeFacade() ;
- int upperBoundExpression2 = typeOfExpression2.getMultiplicityFacade().getUpperBound() ;
- String errorMessageForExpression2 = "" ;
- if (!isANumberType(typeFacadeOfExpression2)) {
- if (upperBoundExpression2 > 1 || upperBoundExpression2 == -1)
- errorMessageForExpression2 += "A scalar number value is expected" ;
- else
- errorMessageForExpression2 += "A number value is expected" ;
+ if(!(errorMessageForExpression1.length() == 0)) {
+ error(errorMessageForExpression1, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX);
}
- else {
- if (upperBoundExpression2 > 1 || upperBoundExpression2 == -1)
- errorMessageForExpression2 += "A scalar value is expected" ;
+ TypeFacade typeFacadeOfExpression2 = typeOfExpression2.getTypeFacade();
+ int upperBoundExpression2 = typeOfExpression2.getMultiplicityFacade().getUpperBound();
+ String errorMessageForExpression2 = "";
+ if(!isANumberType(typeFacadeOfExpression2)) {
+ if(upperBoundExpression2 > 1 || upperBoundExpression2 == -1) {
+ errorMessageForExpression2 += "A scalar number value is expected";
+ } else {
+ errorMessageForExpression2 += "A number value is expected";
+ }
+ } else {
+ if(upperBoundExpression2 > 1 || upperBoundExpression2 == -1) {
+ errorMessageForExpression2 += "A scalar value is expected";
+ }
}
- if (!(errorMessageForExpression2.length() == 0)) {
- error(errorMessageForExpression2, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression2(), INSIGNIFICANT_INDEX) ;
+ if(!(errorMessageForExpression2.length() == 0)) {
+ error(errorMessageForExpression2, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression2(), INSIGNIFICANT_INDEX);
}
}
}
//4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
- else if (loopVariable.getType() != null) {
- // 4.a. type must be resolved
- TypeFacade typeOfVariable = TypeFacadeFactory.eInstance.createVoidFacade(loopVariable.getType()) ;
- if (typeOfVariable instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfVariable ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else { // 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
- TypeExpression typeOfDomain = new TypeUtils().getTypeOfExpression(loopVariable.getExpression()) ;
- if (typeOfDomain.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfDomain.getTypeFacade() ;
- error (error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- int upperBound = typeOfDomain.getMultiplicity().getUpperBound() ;
- if (! (upperBound > 1 || upperBound == -1)) {
- String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected." ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression(), INSIGNIFICANT_INDEX) ;
+ else if(loopVariable.getType() != null) {
+ // 4.a. type must be resolved
+ TypeFacade typeOfVariable = TypeFacadeFactory.eInstance.createVoidFacade(loopVariable.getType());
+ if(typeOfVariable instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfVariable;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else { // 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
+ TypeExpression typeOfDomain = new TypeUtils().getTypeOfExpression(loopVariable.getExpression());
+ if(typeOfDomain.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfDomain.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ int upperBound = typeOfDomain.getMultiplicity().getUpperBound();
+ if(!(upperBound > 1 || upperBound == -1)) {
+ String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected.";
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression(), INSIGNIFICANT_INDEX);
}
- if (typeOfVariable.isCompatibleWithMe(typeOfDomain.getTypeFacade()) == 0) {
- String errorMessage = "Cannot convert from " + typeOfDomain.getTypeFacade().getLabel() + " to " + typeOfVariable.getLabel() ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Type(), INSIGNIFICANT_INDEX) ;
+ if(typeOfVariable.isCompatibleWithMe(typeOfDomain.getTypeFacade()) == 0) {
+ String errorMessage = "Cannot convert from " + typeOfDomain.getTypeFacade().getLabel() + " to " + typeOfVariable.getLabel();
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Type(), INSIGNIFICANT_INDEX);
}
}
}
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. That a return value is actually expected from the context of the ALF specification
- * 2. If a return value is expected, the returned value must be type/multiplicity compatible
- * 3. There must be no statement in the containing statement sequence after the return statement.
+ * Checks the following rule:
+ * 1. That a return value is actually expected from the context of the ALF specification
+ * 2. If a return value is expected, the returned value must be type/multiplicity compatible
+ * 3. There must be no statement in the containing statement sequence after the return statement.
*/
@Check
public void checkReturnStatement(ReturnStatement statement) {
// 1. Checks that a return value is actually expected from the context of the ALF specification
- boolean returnStatementExpected = AlfScopeProvider.scopingTool.isAReturnStatementExpected(statement) ;
- if (returnStatementExpected == false) {
- String errorMessage = "No return statement expected" ;
- error (errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression()) ;
- }
- else {
+ boolean returnStatementExpected = AlfScopeProvider.scopingTool.isAReturnStatementExpected(statement);
+ if(returnStatementExpected == false) {
+ String errorMessage = "No return statement expected";
+ error(errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression());
+ } else {
// 2. If a return value is expected, the returned value must be type/multiplicity compatible
- TypeExpression expectedReturnType = AlfScopeProvider.scopingTool.getExpectedReturnType(statement) ;
- TypeExpression actualReturnType = new TypeUtils().getTypeOfExpression(statement.getExpression()) ;
- if (actualReturnType.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)actualReturnType.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (expectedReturnType.isCompatibleWithMe(actualReturnType) == 0) {
- String errorMessage = "An expression of type " + expectedReturnType.getLabel() + " is expected. Found an expression of type " + actualReturnType.getLabel() ;
- error (errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression()) ;
+ TypeExpression expectedReturnType = AlfScopeProvider.scopingTool.getExpectedReturnType(statement);
+ TypeExpression actualReturnType = new TypeUtils().getTypeOfExpression(statement.getExpression());
+ if(actualReturnType.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)actualReturnType.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(expectedReturnType.isCompatibleWithMe(actualReturnType) == 0) {
+ String errorMessage = "An expression of type " + expectedReturnType.getLabel() + " is expected. Found an expression of type " + actualReturnType.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression());
}
}
}
// 3. There must be no statement (in the containing statement sequence) after the return statement.
- EObject cddStatementSequence = statement.eContainer() ;
- DocumentedStatement contextDocumentedStatement = null ;
- while (cddStatementSequence != null &&
- ! ((cddStatementSequence instanceof StatementSequence) || (cddStatementSequence instanceof NonEmptyStatementSequence))) {
- if (contextDocumentedStatement == null && cddStatementSequence instanceof DocumentedStatement)
- contextDocumentedStatement = (DocumentedStatement)cddStatementSequence ;
- cddStatementSequence = cddStatementSequence.eContainer() ;
+ EObject cddStatementSequence = statement.eContainer();
+ DocumentedStatement contextDocumentedStatement = null;
+ while(cddStatementSequence != null && !((cddStatementSequence instanceof StatementSequence) || (cddStatementSequence instanceof NonEmptyStatementSequence))) {
+ if(contextDocumentedStatement == null && cddStatementSequence instanceof DocumentedStatement) {
+ contextDocumentedStatement = (DocumentedStatement)cddStatementSequence;
+ }
+ cddStatementSequence = cddStatementSequence.eContainer();
}
- if (cddStatementSequence != null && contextDocumentedStatement != null) {
- int statementIndex = 0 ;
- int numberOfStatements = 0 ;
- if (cddStatementSequence instanceof StatementSequence) {
- statementIndex = ((StatementSequence)cddStatementSequence).getStatements().indexOf(contextDocumentedStatement) ;
- numberOfStatements = ((StatementSequence)cddStatementSequence).getStatements().size() ;
+ if(cddStatementSequence != null && contextDocumentedStatement != null) {
+ int statementIndex = 0;
+ int numberOfStatements = 0;
+ if(cddStatementSequence instanceof StatementSequence) {
+ statementIndex = ((StatementSequence)cddStatementSequence).getStatements().indexOf(contextDocumentedStatement);
+ numberOfStatements = ((StatementSequence)cddStatementSequence).getStatements().size();
+ } else {
+ statementIndex = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().indexOf(contextDocumentedStatement);
+ numberOfStatements = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().size();
}
- else {
- statementIndex = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().indexOf(contextDocumentedStatement) ;
- numberOfStatements = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().size() ;
- }
- String errorMessage = "The statement cannot be reached" ;
- for (int i = statementIndex + 1 ; i < numberOfStatements ; i++) {
- DocumentedStatement current = null ;
- if (cddStatementSequence instanceof StatementSequence)
- current = ((StatementSequence)cddStatementSequence).getStatements().get(i) ;
- else
- current = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().get(i) ;
- error(errorMessage, current, AlfPackage.eINSTANCE.getDocumentedStatement_Statement(), INSIGNIFICANT_INDEX) ;
+ String errorMessage = "The statement cannot be reached";
+ for(int i = statementIndex + 1; i < numberOfStatements; i++) {
+ DocumentedStatement current = null;
+ if(cddStatementSequence instanceof StatementSequence) {
+ current = ((StatementSequence)cddStatementSequence).getStatements().get(i);
+ } else {
+ current = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().get(i);
+ }
+ error(errorMessage, current, AlfPackage.eINSTANCE.getDocumentedStatement_Statement(), INSIGNIFICANT_INDEX);
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. Checks that the context classifier is active
- * 2. Each AcceptClause.name (if specified) must be available.
- * 3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
- * 4. Each Signal must be used only once
+ * Checks the following rules:
+ * 1. Checks that the context classifier is active
+ * 2. Each AcceptClause.name (if specified) must be available.
+ * 3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
+ * 4. Each Signal must be used only once
*/
@Check
public void checkAcceptStatement(AcceptStatement statement) {
//1. Checks that the context classifier is active
- if (! (contextClassifier instanceof Class) || !((Class)contextClassifier).isActive()) {
- error("The context classifier must be an active class", AlfPackage.eINSTANCE.getAcceptStatement_Clause()) ;
+ if(!(contextClassifier instanceof Class) || !((Class)contextClassifier).isActive()) {
+ error("The context classifier must be an active class", AlfPackage.eINSTANCE.getAcceptStatement_Clause());
}
-
+
//2. Each AcceptClause.name (if specified) must be available.
- AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- if (statement.getClause().getName() != null ) {
- List<EObject> visibleElements = vppScope.resolveByName(statement.getClause().getName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + statement.getClause().getName() + " is not available" ;
- error(errorMessage, statement.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX) ;
+ AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ if(statement.getClause().getName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(statement.getClause().getName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + statement.getClause().getName() + " is not available";
+ error(errorMessage, statement.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX);
}
}
- if (statement.getCompoundAccept() != null) {
- for (AcceptBlock block : statement.getCompoundAccept().getAcceptBlock()) {
- if (block.getClause() != null && block.getClause().getName() != null) {
- List<EObject> visibleElements = vppScope.resolveByName(block.getClause().getName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + block.getClause().getName() + " is not available" ;
- error(errorMessage, block.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX) ;
+ if(statement.getCompoundAccept() != null) {
+ for(AcceptBlock block : statement.getCompoundAccept().getAcceptBlock()) {
+ if(block.getClause() != null && block.getClause().getName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(block.getClause().getName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + block.getClause().getName() + " is not available";
+ error(errorMessage, block.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX);
}
}
}
}
-
+
//3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
- AlfPartialScope signalReceptionScope = AlfScopeProvider.scopingTool.getVisibleSignalReceptions(statement) ;
- List<TypeFacade> signalReceptionTypeFacade = new ArrayList<TypeFacade>() ;
- for (List<EObject> l : signalReceptionScope.getScopeDetails()) {
- for (EObject m : l) {
- signalReceptionTypeFacade.add(TypeFacadeFactory.eInstance.createTypeFacade(m)) ;
+ AlfPartialScope signalReceptionScope = AlfScopeProvider.scopingTool.getVisibleSignalReceptions(statement);
+ List<TypeFacade> signalReceptionTypeFacade = new ArrayList<TypeFacade>();
+ for(List<EObject> l : signalReceptionScope.getScopeDetails()) {
+ for(EObject m : l) {
+ signalReceptionTypeFacade.add(TypeFacadeFactory.eInstance.createTypeFacade(m));
}
}
- Map<Classifier, List<QualifiedNameWithBinding>> allReferencedSignals= new HashMap<Classifier, List<QualifiedNameWithBinding>>() ;
- if (statement.getClause().getQualifiedNameList() != null) {
- QualifiedNameList list = statement.getClause().getQualifiedNameList() ;
- int index = 0 ;
- for (QualifiedNameWithBinding qualifiedName : list.getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(qualifiedName) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- Classifier actualReferencedClassifier = type.extractActualType() ;
- List<QualifiedNameWithBinding> existingReferences = allReferencedSignals.get(actualReferencedClassifier) ;
- if (existingReferences == null) {
- existingReferences = new ArrayList<QualifiedNameWithBinding>() ;
-
+ Map<Classifier, List<QualifiedNameWithBinding>> allReferencedSignals = new HashMap<Classifier, List<QualifiedNameWithBinding>>();
+ if(statement.getClause().getQualifiedNameList() != null) {
+ QualifiedNameList list = statement.getClause().getQualifiedNameList();
+ int index = 0;
+ for(QualifiedNameWithBinding qualifiedName : list.getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(qualifiedName);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ Classifier actualReferencedClassifier = type.extractActualType();
+ List<QualifiedNameWithBinding> existingReferences = allReferencedSignals.get(actualReferencedClassifier);
+ if(existingReferences == null) {
+ existingReferences = new ArrayList<QualifiedNameWithBinding>();
+
}
- existingReferences.add(qualifiedName) ;
- allReferencedSignals.put(actualReferencedClassifier, existingReferences) ;
- boolean found = false ;
- Iterator<TypeFacade> i = signalReceptionTypeFacade.iterator() ;
- while (i.hasNext() && !found) {
- TypeFacade current = i.next() ;
- if (current.isCompatibleWithMe(type)!=0)
- found = true ;
+ existingReferences.add(qualifiedName);
+ allReferencedSignals.put(actualReferencedClassifier, existingReferences);
+ boolean found = false;
+ Iterator<TypeFacade> i = signalReceptionTypeFacade.iterator();
+ while(i.hasNext() && !found) {
+ TypeFacade current = i.next();
+ if(current.isCompatibleWithMe(type) != 0) {
+ found = true;
+ }
}
- if (!found) {
- String errorMessage = "The context classifier does not define any reception for " + type.getLabel() ;
- error(errorMessage, list, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index) ;
+ if(!found) {
+ String errorMessage = "The context classifier does not define any reception for " + type.getLabel();
+ error(errorMessage, list, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
}
}
- index ++ ;
+ index++;
}
}
-
+
//4. Each Signal must be used only once
- for (Classifier key : allReferencedSignals.keySet()) {
- List<QualifiedNameWithBinding> referencesToKey = allReferencedSignals.get(key) ;
- if (referencesToKey.size()>1) {
- for (QualifiedNameWithBinding qualifiedName : referencesToKey) {
- String errorMessage = "No signal may be named in more than one accept clause" ;
- QualifiedNameList containingList = (QualifiedNameList)qualifiedName.eContainer() ;
- int index = containingList.getQualifiedName().indexOf(qualifiedName) ;
- error(errorMessage, containingList, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index - 1 ) ;
+ for(Classifier key : allReferencedSignals.keySet()) {
+ List<QualifiedNameWithBinding> referencesToKey = allReferencedSignals.get(key);
+ if(referencesToKey.size() > 1) {
+ for(QualifiedNameWithBinding qualifiedName : referencesToKey) {
+ String errorMessage = "No signal may be named in more than one accept clause";
+ QualifiedNameList containingList = (QualifiedNameList)qualifiedName.eContainer();
+ int index = containingList.getQualifiedName().indexOf(qualifiedName);
+ error(errorMessage, containingList, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index - 1);
}
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. The static type of the target expression must be a Class
- * and it must evaluate to a single object
- * 2. All qualified names in from or to lists must resolve to classes
- * 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
- * 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
- *
+ * Checks the following rules:
+ * 1. The static type of the target expression must be a Class
+ * and it must evaluate to a single object
+ * 2. All qualified names in from or to lists must resolve to classes
+ * 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
+ * 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
+ *
*/
@Check
public void checkClassifyStatement(ClassifyStatement statement) {
// 1. The static type of the target expression must be a Class...
- Classifier actualStaticType = null ;
- TypeExpression staticType = new TypeUtils().getTypeOfExpression(statement.getExpression()) ;
- boolean errorFound = false ;
- if (staticType.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)staticType.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
+ Classifier actualStaticType = null;
+ TypeExpression staticType = new TypeUtils().getTypeOfExpression(statement.getExpression());
+ boolean errorFound = false;
+ if(staticType.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)staticType.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ actualStaticType = staticType.getTypeFacade().extractActualType();
}
- else {
- actualStaticType = staticType.getTypeFacade().extractActualType() ;
- }
- if (actualStaticType == null || !(actualStaticType instanceof Class)) {
- String errorMessage = "The type of the target expression must be a class" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression()) ;
- errorFound = true ;
- }
- else {
+ if(actualStaticType == null || !(actualStaticType instanceof Class)) {
+ String errorMessage = "The type of the target expression must be a class";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression());
+ errorFound = true;
+ } else {
//... and it must evaluate to a single object
- int upperBound = staticType.getMultiplicityFacade().getUpperBound() ;
- if (upperBound > 1 || upperBound == -1) {
- String errorMessage = "The target expression must evaluate to a single object" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression()) ;
- errorFound = true ;
+ int upperBound = staticType.getMultiplicityFacade().getUpperBound();
+ if(upperBound > 1 || upperBound == -1) {
+ String errorMessage = "The target expression must evaluate to a single object";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression());
+ errorFound = true;
}
}
-
+
// 2. All qualified names in from or to lists must resolve to classes
- ClassificationClause classificationClause = statement.getClause() ;
- List<Class> fromClasses = new ArrayList<Class>() ;
- List<Class> toClasses = new ArrayList<Class>() ;
- if (classificationClause == null)
- return ;
- boolean isAReclassifyFromAll = false ;
- if (classificationClause.getClassifyFromClause() == null &&
- classificationClause.getClassifyToClause() == null &&
- classificationClause.getReclassyAllClause() == null)
- return ;
- if (classificationClause.getReclassyAllClause() != null)
+ ClassificationClause classificationClause = statement.getClause();
+ List<Class> fromClasses = new ArrayList<Class>();
+ List<Class> toClasses = new ArrayList<Class>();
+ if(classificationClause == null) {
+ return;
+ }
+ boolean isAReclassifyFromAll = false;
+ if(classificationClause.getClassifyFromClause() == null && classificationClause.getClassifyToClause() == null && classificationClause.getReclassyAllClause() == null) {
+ return;
+ }
+ if(classificationClause.getReclassyAllClause() != null) {
// nothing to do with the from list
- isAReclassifyFromAll = true ;
- if (classificationClause.getClassifyFromClause() != null) {
- ClassificationFromClause fromClause = classificationClause.getClassifyFromClause() ;
- for (QualifiedNameWithBinding name : fromClause.getQualifiedNameList().getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
- }
- else {
- Classifier actualType = type.extractActualType(type) ;
- if (actualType == null || !(actualType instanceof Class)) {
- String errorMessage = "All types in the 'from' list must be Classes" ;
- int index = fromClause.getQualifiedNameList().getQualifiedName().indexOf(name) ;
- error(errorMessage,
- fromClause.getQualifiedNameList(),
- AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(),
- index) ;
- }
- else {
- fromClasses.add((Class)actualType) ;
+ isAReclassifyFromAll = true;
+ }
+ if(classificationClause.getClassifyFromClause() != null) {
+ ClassificationFromClause fromClause = classificationClause.getClassifyFromClause();
+ for(QualifiedNameWithBinding name : fromClause.getQualifiedNameList().getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ Classifier actualType = type.extractActualType(type);
+ if(actualType == null || !(actualType instanceof Class)) {
+ String errorMessage = "All types in the 'from' list must be Classes";
+ int index = fromClause.getQualifiedNameList().getQualifiedName().indexOf(name);
+ error(errorMessage, fromClause.getQualifiedNameList(), AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
+ } else {
+ fromClasses.add((Class)actualType);
}
}
}
}
- if (classificationClause.getClassifyToClause() != null) {
- ClassificationToClause toClause = classificationClause.getClassifyToClause() ;
- for (QualifiedNameWithBinding name : toClause.getQualifiedNameList().getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
- }
- else {
- Classifier actualType = type.extractActualType(type) ;
- if (actualType == null || !(actualType instanceof Class)) {
- String errorMessage = "All types in the 'from' list must be Classes" ;
- int index = toClause.getQualifiedNameList().getQualifiedName().indexOf(name) ;
- error(errorMessage,
- toClause.getQualifiedNameList(),
- AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(),
- index) ;
- }
- else {
- toClasses.add((Class)actualType) ;
+ if(classificationClause.getClassifyToClause() != null) {
+ ClassificationToClause toClause = classificationClause.getClassifyToClause();
+ for(QualifiedNameWithBinding name : toClause.getQualifiedNameList().getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ Classifier actualType = type.extractActualType(type);
+ if(actualType == null || !(actualType instanceof Class)) {
+ String errorMessage = "All types in the 'from' list must be Classes";
+ int index = toClause.getQualifiedNameList().getQualifiedName().indexOf(name);
+ error(errorMessage, toClause.getQualifiedNameList(), AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
+ } else {
+ toClasses.add((Class)actualType);
}
}
}
}
-
-
+
+
// 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
- if (errorFound)
- return ; // not necessary to check the remaining
- List<Classifier> fromGenerals = new ArrayList<Classifier>() ;
- List<Classifier> toGenerals = new ArrayList<Classifier>() ;
- if (actualStaticType != null && !errorFound) {
- String errorMessage = "All classes in the 'from' list must be subclasses of the target expression type" ;
- int index = 0 ;
- for (Class c : fromClasses) {
- if (! c.allParents().contains(actualStaticType)) {
- error(errorMessage,
- classificationClause.getClassifyFromClause(),
- AlfPackage.eINSTANCE.getClassificationFromClause_QualifiedNameList(),
- index) ;
- errorFound = true ;
+ if(errorFound) {
+ return; // not necessary to check the remaining
+ }
+ List<Classifier> fromGenerals = new ArrayList<Classifier>();
+ List<Classifier> toGenerals = new ArrayList<Classifier>();
+ if(actualStaticType != null && !errorFound) {
+ String errorMessage = "All classes in the 'from' list must be subclasses of the target expression type";
+ int index = 0;
+ for(Class c : fromClasses) {
+ if(!c.allParents().contains(actualStaticType)) {
+ error(errorMessage, classificationClause.getClassifyFromClause(), AlfPackage.eINSTANCE.getClassificationFromClause_QualifiedNameList(), index);
+ errorFound = true;
}
- fromGenerals.addAll(c.allParents()) ;
- index++ ;
+ fromGenerals.addAll(c.allParents());
+ index++;
}
- errorMessage = "All classes in the 'to' list must be subclasses of the target expression type" ;
- index = 0 ;
- for (Class c : toClasses) {
- if (! c.allParents().contains(actualStaticType)) {
- error(errorMessage,
- classificationClause.getClassifyToClause(),
- AlfPackage.eINSTANCE.getClassificationToClause_QualifiedNameList(),
- index) ;
- errorFound = true ;
+ errorMessage = "All classes in the 'to' list must be subclasses of the target expression type";
+ index = 0;
+ for(Class c : toClasses) {
+ if(!c.allParents().contains(actualStaticType)) {
+ error(errorMessage, classificationClause.getClassifyToClause(), AlfPackage.eINSTANCE.getClassificationToClause_QualifiedNameList(), index);
+ errorFound = true;
}
- index++ ;
- toGenerals.addAll(c.allParents()) ;
+ index++;
+ toGenerals.addAll(c.allParents());
}
}
-
+
// 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
- if (errorFound)
- return ; // not necessary to go further
- fromGenerals.retainAll(toGenerals) ;
- for (Classifier c : fromGenerals) {
- if (c.allParents().contains(actualStaticType)) {
- String errorMessage = "Superclasses of classes in 'to' and 'from' lists must be disjoint subclasses of the target expression type" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Clause()) ;
- return ;
+ if(errorFound) {
+ return; // not necessary to go further
+ }
+ fromGenerals.retainAll(toGenerals);
+ for(Classifier c : fromGenerals) {
+ if(c.allParents().contains(actualStaticType)) {
+ String errorMessage = "Superclasses of classes in 'to' and 'from' lists must be disjoint subclasses of the target expression type";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Clause());
+ return;
}
}
-
+
}
-
+
/**
* @param statement
- * Checks the following rules:
- * 1. The statement must respect construction rules of:
- * 1.a Invocation, or
- * 1.b Variable declaration, or
- * 1.c Assignment expression
- * 2. According to the construction rule, delegate to the appropriate check method
+ * Checks the following rules:
+ * 1. The statement must respect construction rules of:
+ * 1.a Invocation, or
+ * 1.b Variable declaration, or
+ * 1.c Assignment expression
+ * 2. According to the construction rule, delegate to the appropriate check method
*/
@Check
public void checkInvocationOrAssignmentOrDeclarationStatement(InvocationOrAssignementOrDeclarationStatement statement) {
//1. The statement must respect construction rules of:
// 1.b Variable declaration
- if (statement.getVariableDeclarationCompletion() != null) {
- checkVariableDeclarationStatement(statement) ;
+ if(statement.getVariableDeclarationCompletion() != null) {
+ checkVariableDeclarationStatement(statement);
}
// 1.c Assignment expression
- else if (statement.getAssignmentCompletion() != null) {
- checkAssignmentExpression(statement) ;
+ else if(statement.getAssignmentCompletion() != null) {
+ checkAssignmentExpression(statement);
}
// 1.a Invocation or prefix or suffix
else {
- checkInvocationOrPrefixOrSuffixStatement(statement) ;
+ checkInvocationOrPrefixOrSuffixStatement(statement);
}
}
-
+
/**
* @param statement
- * Checks the following rules:
- * 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
- * 2. if it is an invocation:
- * 2.a The name must resolve to a Behavior or an Operation
- * 2.b Arguments must be type compatibles with the parameters of referenced behavior or operation
- * 3. if it is a prefixOp:
- * 3.a the name must resolve to an assignable property, parameter or local variable
- * 3.b the operator must be available for the type of the nameExpression
- * 4. if it is a postfixOp:
- * 4.a the name must resolve to an assignable property, parameter or local variable
- * 4.b the operator must be available for the type of the nameExpression
+ * Checks the following rules:
+ * 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
+ * 2. if it is an invocation:
+ * 2.a The name must resolve to a Behavior or an Operation
+ * 2.b Arguments must be type compatibles with the parameters of referenced behavior or operation
+ * 3. if it is a prefixOp:
+ * 3.a the name must resolve to an assignable property, parameter or local variable
+ * 3.b the operator must be available for the type of the nameExpression
+ * 4. if it is a postfixOp:
+ * 4.a the name must resolve to an assignable property, parameter or local variable
+ * 4.b the operator must be available for the type of the nameExpression
*/
private void checkInvocationOrPrefixOrSuffixStatement(InvocationOrAssignementOrDeclarationStatement statement) {
// 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
- boolean isAnInvocation = statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null ;
- boolean isAPrefixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() != null ;
- boolean isAPostfixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() != null ;
- boolean hasASuffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() != null ;
- int resolvedKindOfExpression = 0 ;
- resolvedKindOfExpression += isAnInvocation ? 1 : 0 ;
- resolvedKindOfExpression += isAPrefixExpression ? 1 : 0 ;
- resolvedKindOfExpression += isAPostfixExpression ? 1 : 0 ;
- resolvedKindOfExpression += hasASuffix ? 1 : 0 ;
- if ((resolvedKindOfExpression > 1 && !hasASuffix) || resolvedKindOfExpression==0) {
- String errorMessage = "An invocation expression, OR a prefix expression, OR a postfix expression is expected." ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ boolean isAnInvocation = statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null;
+ boolean isAPrefixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() != null;
+ boolean isAPostfixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() != null;
+ boolean hasASuffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() != null;
+ int resolvedKindOfExpression = 0;
+ resolvedKindOfExpression += isAnInvocation ? 1 : 0;
+ resolvedKindOfExpression += isAPrefixExpression ? 1 : 0;
+ resolvedKindOfExpression += isAPostfixExpression ? 1 : 0;
+ resolvedKindOfExpression += hasASuffix ? 1 : 0;
+ if((resolvedKindOfExpression > 1 && !hasASuffix) || resolvedKindOfExpression == 0) {
+ String errorMessage = "An invocation expression, OR a prefix expression, OR a postfix expression is expected.";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
-
+
//2. if it is an invocation:
- if (isAnInvocation || hasASuffix) {
+ if(isAnInvocation || hasASuffix) {
// 2.a The name must resolve to a Variable, a Parameter, a Property, a Behavior or an Operation (TODO: can also be an association)
- NameExpression varOrParamOrPropOrOpOrBehav = statement.getTypePart_OR_assignedPart_OR_invocationPart() ;
- TypeExpression typeOfPrefix = new TypeUtils().getTypeOfNameExpression(varOrParamOrPropOrOpOrBehav) ;
- if (typeOfPrefix.getTypeFacade() != null && typeOfPrefix.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfPrefix.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ NameExpression varOrParamOrPropOrOpOrBehav = statement.getTypePart_OR_assignedPart_OR_invocationPart();
+ TypeExpression typeOfPrefix = new TypeUtils().getTypeOfNameExpression(varOrParamOrPropOrOpOrBehav);
+ if(typeOfPrefix.getTypeFacade() != null && typeOfPrefix.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfPrefix.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
- if (hasASuffix) {
+ if(hasASuffix) {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An invocation is expected",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An invocation is expected", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
}
//}
}
-
+
// 3. if it is a prefixOp: or // 4. if it is a postfixOp:
- else if (isAPrefixExpression || isAPostfixExpression) {
- TypeExpression typeOfAssignedElement = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (typeOfAssignedElement.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignedElement.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ else if(isAPrefixExpression || isAPostfixExpression) {
+ TypeExpression typeOfAssignedElement = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(typeOfAssignedElement.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignedElement.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
//1. The assigned part must be assignable, i.e.:
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null
- && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()==null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId().length() == 0)) {
- error("The assigned part must resolve to an assignable property, parameter or local variable",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId() == null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId().length() == 0)) {
+ error("The assigned part must resolve to an assignable property, parameter or local variable", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
//1.a It must resolve to a property, or
//1.b It must resolve to a local variable, or
//1.c It must resolve to an out or inout parameter
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
- AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0) ;
- String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved) ;
- if (!(potentialAssignmentError.length() == 0)) {
- error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
+ AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0);
+ String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved);
+ if(!(potentialAssignmentError.length() == 0)) {
+ error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
- }
- else {// a suffix is specified
- // The last suffix must be a property call expression
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ } else {// a suffix is specified
+ // The last suffix must be a property call expression
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (! (lastSuffix instanceof PropertyCallExpression)) {
- error("The assigned part must resolve to an assignable property, parameter or local variable",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ error("The assigned part must resolve to an assignable property, parameter or local variable", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
}
-
- TypeExpression integerExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._integer) ;
- TypeExpression naturalExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._natural) ;
- TypeExpression unlimitedExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._unlimited) ;
- String operator = isAPrefixExpression ? statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() : statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() ;
- EStructuralFeature feature = isAPrefixExpression ? AlfPackage.eINSTANCE.getNameExpression_PrefixOp() : AlfPackage.eINSTANCE.getNameExpression_PostfixOp() ;
- if (! (integerExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0 ||
- naturalExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0 ||
- unlimitedExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0)) {
- error("Operator " + operator + " does not apply to " + typeOfAssignedElement.getLabel() ,
- statement.getTypePart_OR_assignedPart_OR_invocationPart(),
- feature,
- INSIGNIFICANT_INDEX) ;
+
+ TypeExpression integerExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._integer);
+ TypeExpression naturalExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._natural);
+ TypeExpression unlimitedExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._unlimited);
+ String operator = isAPrefixExpression ? statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() : statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp();
+ EStructuralFeature feature = isAPrefixExpression ? AlfPackage.eINSTANCE.getNameExpression_PrefixOp() : AlfPackage.eINSTANCE.getNameExpression_PostfixOp();
+ if(!(integerExpression.isCompatibleWithMe(typeOfAssignedElement) != 0 || naturalExpression.isCompatibleWithMe(typeOfAssignedElement) != 0 || unlimitedExpression.isCompatibleWithMe(typeOfAssignedElement) != 0)) {
+ error("Operator " + operator + " does not apply to " + typeOfAssignedElement.getLabel(), statement.getTypePart_OR_assignedPart_OR_invocationPart(), feature, INSIGNIFICANT_INDEX);
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
- * 2. the variable name must be available
- * 3. initValue must respect the following sub-rules:
- * 3.a the type of the expression must be compatible with the type of the variable
- * 3.b the assignment operator must be '='
+ * Checks the following rule:
+ * 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
+ * 2. the variable name must be available
+ * 3. initValue must respect the following sub-rules:
+ * 3.a the type of the expression must be compatible with the type of the variable
+ * 3.b the assignment operator must be '='
*/
private void checkVariableDeclarationStatement(InvocationOrAssignementOrDeclarationStatement statement) {
// 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
- VoidFacade actualVariableType = null ;
- TypeFacade cddVariableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (cddVariableType instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)cddVariableType ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- actualVariableType = (VoidFacade)cddVariableType ;
+ VoidFacade actualVariableType = null;
+ TypeFacade cddVariableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(cddVariableType instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)cddVariableType;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ actualVariableType = (VoidFacade)cddVariableType;
}
- VariableDeclarationCompletion declaration = statement.getVariableDeclarationCompletion() ;
- TypeExpression variableTypeExpression = null ;
- if (actualVariableType != null) {
- if (declaration.isMultiplicityIndicator())
- variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 0, -1, false, true) ;
- else
- variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 1, 1, true, false) ;
+ VariableDeclarationCompletion declaration = statement.getVariableDeclarationCompletion();
+ TypeExpression variableTypeExpression = null;
+ if(actualVariableType != null) {
+ if(declaration.isMultiplicityIndicator()) {
+ variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 0, -1, false, true);
+ } else {
+ variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 1, 1, true, false);
+ }
}
-
+
// 2. the variable name must be available
- AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- if (declaration.getVariableName() != null ) {
- List<EObject> visibleElements = vppScope.resolveByName(declaration.getVariableName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + declaration.getVariableName() + " is not available" ;
- error(errorMessage, declaration, AlfPackage.eINSTANCE.getVariableDeclarationCompletion_VariableName(), INSIGNIFICANT_INDEX) ;
+ AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ if(declaration.getVariableName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(declaration.getVariableName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + declaration.getVariableName() + " is not available";
+ error(errorMessage, declaration, AlfPackage.eINSTANCE.getVariableDeclarationCompletion_VariableName(), INSIGNIFICANT_INDEX);
}
}
-
+
//3. initValue must respect the following sub-rules:
- if (declaration.getInitValue() != null && declaration.getInitValue().getRightHandSide() != null) {
- TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(declaration.getInitValue().getRightHandSide()) ;
- if (typeOfInit == null) {
- String errorMessage = "Init value is missing" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_VariableDeclarationCompletion()) ;
- return ;
+ if(declaration.getInitValue() != null && declaration.getInitValue().getRightHandSide() != null) {
+ TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(declaration.getInitValue().getRightHandSide());
+ if(typeOfInit == null) {
+ String errorMessage = "Init value is missing";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_VariableDeclarationCompletion());
+ return;
}
- if (typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ if(typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
- if (variableTypeExpression != null) {
+ if(variableTypeExpression != null) {
// 3.a the type of the expression must be compatible with the type of the variable
- if (variableTypeExpression.isCompatibleWithMe(typeOfInit) == 0) {
- String errorMessage = "Expecting an expression of type " + variableTypeExpression.getLabel() +
- ". Found an expression of type " + typeOfInit.getLabel() + "." ;
- error(errorMessage,
- declaration.getInitValue(),
- AlfPackage.eINSTANCE.getAssignmentCompletion_RightHandSide(),
- INSIGNIFICANT_INDEX) ;
+ if(variableTypeExpression.isCompatibleWithMe(typeOfInit) == 0) {
+ String errorMessage = "Expecting an expression of type " + variableTypeExpression.getLabel() + ". Found an expression of type " + typeOfInit.getLabel() + ".";
+ error(errorMessage, declaration.getInitValue(), AlfPackage.eINSTANCE.getAssignmentCompletion_RightHandSide(), INSIGNIFICANT_INDEX);
}
// 3.b the assignment operator must be '='
- else if (declaration.getInitValue().getOp() != AssignmentOperator.ASSIGN) {
- String errorMessage = "Expecting assignment operator '='" ;
- error(errorMessage,
- declaration.getInitValue(),
- AlfPackage.eINSTANCE.getAssignmentCompletion_Op(),
- INSIGNIFICANT_INDEX) ;
+ else if(declaration.getInitValue().getOp() != AssignmentOperator.ASSIGN) {
+ String errorMessage = "Expecting assignment operator '='";
+ error(errorMessage, declaration.getInitValue(), AlfPackage.eINSTANCE.getAssignmentCompletion_Op(), INSIGNIFICANT_INDEX);
}
}
}
}
-
-
+
+
/**
*
* @param statement
*
- * Checks the following rules:
- * 1. The left part must be assignable, i.e.:
- * 1.a It must resolve to a property, or
- * 1.b It must resolve to a local variable, or
- * 1.c It must resolve to an out or inout parameter
- * 1.d It resolves to an association end TODO: Not supported yet
- * 2. If the assignment operator is "=", the right part must be type compatible with the left part
- * 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ * Checks the following rules:
+ * 1. The left part must be assignable, i.e.:
+ * 1.a It must resolve to a property, or
+ * 1.b It must resolve to a local variable, or
+ * 1.c It must resolve to an out or inout parameter
+ * 1.d It resolves to an association end TODO: Not supported yet
+ * 2. If the assignment operator is "=", the right part must be type compatible with the left part
+ * 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
*/
private void checkAssignmentExpression(InvocationOrAssignementOrDeclarationStatement statement) {
- boolean errorInExpressions = false ;
+ boolean errorInExpressions = false;
// first infer type of the left part
- TypeExpression typeOfLeft = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (typeOfLeft.getTypeFacade() == null || typeOfLeft.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfLeft.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfLeft = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(typeOfLeft.getTypeFacade() == null || typeOfLeft.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfLeft.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
// then infer type of the right part
- TypeExpression typeOfRight = null ;
- if (statement.getAssignmentCompletion().getRightHandSide() != null) {
- typeOfRight = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide()) ;
- if (typeOfRight == null || typeOfRight.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfRight.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfRight = null;
+ if(statement.getAssignmentCompletion().getRightHandSide() != null) {
+ typeOfRight = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide());
+ if(typeOfRight == null || typeOfRight.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfRight.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
}
- if (errorInExpressions) // not necessary to validate further
- return ;
-
+ if(errorInExpressions) {
+ return;
+ }
+
//1. The left part must be assignable, i.e.:
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null
- && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp()!=null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp()!=null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null)) {
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) {
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion().getAccessCompletion() != null)
- return ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() != null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() != null) || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null)) {
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) {
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion().getAccessCompletion() != null) {
+ return;
+ }
}
- error("The left part of the assignment must resolve to an assignable property, parameter or local variable",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
+ error("The left part of the assignment must resolve to an assignable property, parameter or local variable", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
// NOTE: this an approximation. Cf. => rule 1.d It resolves to an association end TODO: Not supported yet
- return ;
+ return;
}
//1.a It must resolve to a property, or
//1.b It must resolve to a local variable, or
//1.c It must resolve to an out or inout parameter
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
- AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0) ;
- String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved) ;
- if (!(potentialAssignmentError.length() == 0)) {
- error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
+ AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0);
+ String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved);
+ if(!(potentialAssignmentError.length() == 0)) {
+ error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
}
- }
- else {// a suffix is specified
- // The last suffix must be a property call expression
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ } else {// a suffix is specified
+ // The last suffix must be a property call expression
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (! (lastSuffix instanceof PropertyCallExpression)) {
- error("The left part of the assignment must resolve to an assignable property, parameter or local variable",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ error("The left part of the assignment must resolve to an assignable property, parameter or local variable", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
}
-
+
// 2. If the assignment operator is "=", the right part must be type compatible with the left part
- if (statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
- if (typeOfRight.getTypeFacade() == TypeUtils._undefined) {
- String errorMessage = "Right part is untyped" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
- }
- else if (typeOfLeft.isCompatibleWithMe(typeOfRight) == 0) {
- String errorMessage = "Cannot assign " + typeOfRight.getLabel() + " to " + typeOfLeft.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ if(statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
+ if(typeOfRight.getTypeFacade() == TypeUtils._undefined) {
+ String errorMessage = "Right part is untyped";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
+ } else if(typeOfLeft.isCompatibleWithMe(typeOfRight) == 0) {
+ String errorMessage = "Cannot assign " + typeOfRight.getLabel() + " to " + typeOfLeft.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
}
- }
- else { // 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp()) ;
- List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp) ;
- List<TypeExpression> arguments = new ArrayList<TypeExpression>() ;
- arguments.add(typeOfLeft) ;
- arguments.add(typeOfRight) ;
- List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates) ;
- if (matchingSignatures.isEmpty()) {
- String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (" ;
- boolean first = true ;
- for (TypeExpression argType : arguments) {
- if (!first)
- errorMessage += ", " ;
- else
- first = false ;
- errorMessage += argType.getLabel() ;
+ } else { // 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp());
+ List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp);
+ List<TypeExpression> arguments = new ArrayList<TypeExpression>();
+ arguments.add(typeOfLeft);
+ arguments.add(typeOfRight);
+ List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates);
+ if(matchingSignatures.isEmpty()) {
+ String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (";
+ boolean first = true;
+ for(TypeExpression argType : arguments) {
+ if(!first) {
+ errorMessage += ", ";
+ } else {
+ first = false;
+ }
+ errorMessage += argType.getLabel();
}
- errorMessage += ")" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ errorMessage += ")";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. The associated SuperInvocationExpression must be valid
+ * Checks the following rule:
+ * 1. The associated SuperInvocationExpression must be valid
*/
@Check
public void checkSuperInvocationStatement(SuperInvocationStatement statement) {
- TypeExpression typeOfSuperInvocationExp = new TypeUtils().getTypeOfSuperInvocationExpression(statement.get_super()) ;
- if (typeOfSuperInvocationExp.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfSuperInvocationExp.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ TypeExpression typeOfSuperInvocationExp = new TypeUtils().getTypeOfSuperInvocationExpression(statement.get_super());
+ if(typeOfSuperInvocationExp.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfSuperInvocationExp.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
}
-
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. The associated ThisExpression must be valid
- * 2. If an assignment is specified:
- * 2.a The left part must resolve to a property call expression
- * 2.b If the assignment operator is "=", the right part must be type compatible with the left part
- * 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- * 3. If no assignment is specified, the suffix must resolve to an invocation
+ * Checks the following rules:
+ * 1. The associated ThisExpression must be valid
+ * 2. If an assignment is specified:
+ * 2.a The left part must resolve to a property call expression
+ * 2.b If the assignment operator is "=", the right part must be type compatible with the left part
+ * 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ * 3. If no assignment is specified, the suffix must resolve to an invocation
*/
@Check
public void checkThisInvocationStatement(ThisInvocationStatement statement) {
// 1. The associated ThisExpression must be valid
- TypeExpression typeOfThisExpression = new TypeUtils().getTypeOfThisExpression(statement.get_this()) ;
- if (typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfThisExpression.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
+ TypeExpression typeOfThisExpression = new TypeUtils().getTypeOfThisExpression(statement.get_this());
+ if(typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfThisExpression.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
// return ;
}
-
+
// 2. If an assignment is specified
- if (statement.getAssignmentCompletion() != null ) {
+ if(statement.getAssignmentCompletion() != null) {
// 2.a The left part must resolve to a property call expression
- if (statement.get_this().getSuffix() == null) {
- error("A Property call expression is missing",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
+ if(statement.get_this().getSuffix() == null) {
+ error("A Property call expression is missing", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
//return ;
- }
- else {
+ } else {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_this().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_this().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (!(lastSuffix instanceof PropertyCallExpression)) {
- error("The expression should resolve to a Property",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ error("The expression should resolve to a Property", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
//return ;
}
}
-
- TypeExpression typeOfAssignment = null ;
-
- if (statement.getAssignmentCompletion().getRightHandSide() == null)
- return ;
- else {
- typeOfAssignment = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide()) ;
- if (typeOfAssignment.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignment.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+
+ TypeExpression typeOfAssignment = null;
+
+ if(statement.getAssignmentCompletion().getRightHandSide() == null) {
+ return;
+ } else {
+ typeOfAssignment = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide());
+ if(typeOfAssignment.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignment.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
+ }
+ if(typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ return;
}
- if (typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade)
- return ;
}
-
+
// 2.b If the assignment operator is "=", the right part must be type compatible with the left part
- if (statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
- if (typeOfAssignment.getTypeFacade() == TypeUtils._undefined) {
- String errorMessage = "Right part is untyped" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ if(statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
+ if(typeOfAssignment.getTypeFacade() == TypeUtils._undefined) {
+ String errorMessage = "Right part is untyped";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
+ } else if(typeOfThisExpression.isCompatibleWithMe(typeOfAssignment) == 0) {
+ String errorMessage = "Cannot assign " + typeOfAssignment.getLabel() + " to " + typeOfThisExpression.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion());
}
- else if (typeOfThisExpression.isCompatibleWithMe(typeOfAssignment) == 0) {
- String errorMessage = "Cannot assign " + typeOfAssignment.getLabel() + " to " + typeOfThisExpression.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion()) ;
- }
- }
- else { // 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp()) ;
- List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp) ;
- List<TypeExpression> arguments = new ArrayList<TypeExpression>() ;
- arguments.add(typeOfThisExpression) ;
- arguments.add(typeOfAssignment) ;
- List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates) ;
- if (matchingSignatures.isEmpty()) {
- String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (" ;
- boolean first = true ;
- for (TypeExpression argType : arguments) {
- if (!first)
- errorMessage += ", " ;
- else
- first = false ;
- errorMessage += argType.getLabel() ;
+ } else { // 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp());
+ List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp);
+ List<TypeExpression> arguments = new ArrayList<TypeExpression>();
+ arguments.add(typeOfThisExpression);
+ arguments.add(typeOfAssignment);
+ List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates);
+ if(matchingSignatures.isEmpty()) {
+ String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (";
+ boolean first = true;
+ for(TypeExpression argType : arguments) {
+ if(!first) {
+ errorMessage += ", ";
+ } else {
+ first = false;
+ }
+ errorMessage += argType.getLabel();
}
- errorMessage += ")" ;
- error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion()) ;
+ errorMessage += ")";
+ error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion());
}
}
- }
- else { // 3. If no assignment is specified, the suffix must resolve to an invocation
- if (statement.get_this().getSuffix() == null) {
- error("An invocation expression is expected",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
- return ;
- }
- else {
+ } else { // 3. If no assignment is specified, the suffix must resolve to an invocation
+ if(statement.get_this().getSuffix() == null) {
+ error("An invocation expression is expected", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
+ return;
+ } else {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_this().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_this().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An assignment is expected",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An assignment is expected", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
+ return;
}
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. The InstanceCreationExpression must be valid
- * 2. If a suffix is specified, it must resolve to an invocation
+ * Checks the following rule:
+ * 1. The InstanceCreationExpression must be valid
+ * 2. If a suffix is specified, it must resolve to an invocation
*/
@Check
public void checkInstanceCreationInvocationStatement(InstanceCreationInvocationStatement statement) {
// 1. The InstanceCreationExpression must be valid
- TypeExpression typeOfInstanceCreationExpression = new TypeUtils().getTypeOfInstanceCreationExpression(statement.get_new()) ;
- if (typeOfInstanceCreationExpression.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInstanceCreationExpression.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ TypeExpression typeOfInstanceCreationExpression = new TypeUtils().getTypeOfInstanceCreationExpression(statement.get_new());
+ if(typeOfInstanceCreationExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInstanceCreationExpression.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
-
+
// 2. If a suffix is specified, it must resolve to an invocation
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_new().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_new().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An invocation is expected",
- AlfPackage.eINSTANCE.getInstanceCreationInvocationStatement__new()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An invocation is expected", AlfPackage.eINSTANCE.getInstanceCreationInvocationStatement__new());
+ return;
}
}
-
+
private String assignmentOpToString(AssignmentOperator operator) {
- switch (operator) {
+ switch(operator) {
case ANDASSIGN:
- return "&" ;
+ return "&";
case DIVASSIGN:
- return "/" ;
+ return "/";
case LSHIFTASSIGN:
- return "<<" ;
+ return "<<";
case MINUSASSIGN:
- return "-" ;
+ return "-";
case MODASSIGN:
- return "%" ;
+ return "%";
case MULTASSIGN:
- return "*" ;
+ return "*";
case ORASSIGN:
- return "|" ;
+ return "|";
case PLUSASSIGN:
- return "+" ;
+ return "+";
case RSHIFTASSIGN:
- return ">>" ;
+ return ">>";
case URSHIFTASSIGN:
- return ">>>" ;
+ return ">>>";
case XORASSIGN:
- return "^" ;
+ return "^";
case ASSIGN:
- return "=" ;
+ return "=";
}
- return "" ; // not reachable
+ return ""; // not reachable
}
-
+
private boolean isANumberType(TypeFacade typeFacade) {
- return TypeUtils._integer.isCompatibleWithMe(typeFacade) == 3 ||
- TypeUtils._natural.isCompatibleWithMe(typeFacade) == 3 ||
- TypeUtils._unlimited.isCompatibleWithMe(typeFacade) == 3 ;
+ return TypeUtils._integer.isCompatibleWithMe(typeFacade) == 3 || TypeUtils._natural.isCompatibleWithMe(typeFacade) == 3 || TypeUtils._unlimited.isCompatibleWithMe(typeFacade) == 3;
}
-
+
@Check
public void checkTemplateBindingInNameExpression(UnqualifiedName expression) {
- if (expression.getTemplateBinding() != null) {
- String errorMessage = "Template bindings are not supported in name expressions." ; // TODO
- warning(errorMessage, AlfPackage.eINSTANCE.getUnqualifiedName_TemplateBinding()) ;
+ if(expression.getTemplateBinding() != null) {
+ String errorMessage = "Template bindings are not supported in name expressions."; // TODO
+ warning(errorMessage, AlfPackage.eINSTANCE.getUnqualifiedName_TemplateBinding());
}
}
-
+
@Check
public void checkTemplateBindingInQualifiedNameWithBinding(QualifiedNameWithBinding expression) {
//if (expression.getBinding() != null) {
@@ -1427,4 +1381,4 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
// warning(errorMessage, AlfPackage.eINSTANCE.getQualifiedNameWithBinding_Binding()) ;
//}
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
index 1512ee93d7b..e907d717353 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
@@ -89,7 +89,7 @@
This is the class that implements the provider.
</documentation>
<appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.uml.diagram.paletteconfiguration.service.IAspectActionProvider"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectActionProvider"/>
</appInfo>
</annotation>
</attribute>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
index ab0abafaf42..c3a6f30ecc2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
@@ -130,7 +130,7 @@ public abstract class GraphicalCommandHandler extends AbstractHandler {
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
index 9bd01a2c2fa..fae86a714fa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.providers;
+import java.util.List;
+
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Locator;
@@ -20,7 +22,6 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.handles.HandleBounds;
@@ -47,9 +48,9 @@ public class DiagramDecorationAdapter {
/** The decoration. */
- protected EList<IDecoration> decorations;
+ protected List<IDecoration> decorations;
- protected EList<IPapyrusDecoration> pDecorations;
+ protected List<IPapyrusDecoration> pDecorations;
/** The decoration image. */
protected Image decorationImage;
@@ -132,7 +133,7 @@ public class DiagramDecorationAdapter {
* the is volatile
* @return the set of JFace decorations
*/
- public EList<IDecoration> setDecorations(EList<IPapyrusDecoration> pDecorations, int percentageFromSource, int margin, boolean isVolatile) {
+ public List<IDecoration> setDecorations(List<IPapyrusDecoration> pDecorations, int percentageFromSource, int margin, boolean isVolatile) {
final int distBetweenIconsPercent = 20;
final int percentageMin = 10;
@@ -321,10 +322,7 @@ public class DiagramDecorationAdapter {
}
public void relocate(IFigure target) {
- Rectangle bounds =
- reference instanceof HandleBounds
- ? new PrecisionRectangle(((HandleBounds)reference).getHandleBounds())
- : new PrecisionRectangle(reference.getBounds());
+ Rectangle bounds = reference instanceof HandleBounds ? new PrecisionRectangle(((HandleBounds)reference).getHandleBounds()) : new PrecisionRectangle(reference.getBounds());
reference.translateToAbsolute(bounds);
target.translateToRelative(bounds);
@@ -337,8 +335,7 @@ public class DiagramDecorationAdapter {
if(decorationX > pTL.x) {
// only set position, if it is inside the figure, i.e. bigger than left margin
pDecoration.setX(decorationX);
- }
- else {
+ } else {
pDecoration.setX(pTL.x);
}
target.setLocation(pDecoration);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
index 1c9b0020c6b..6fffc9ccdfc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
@@ -18,11 +18,11 @@ package org.eclipse.papyrus.uml.diagram.common.providers;
import static org.eclipse.papyrus.uml.diagram.common.Activator.log;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
@@ -172,7 +172,7 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
// add decoration
if(editPart instanceof org.eclipse.gef.GraphicalEditPart) {
if(view.getElement() != null) {
- EList<IPapyrusDecoration> decorations = decorationService.getDecorations(view.getElement(), false);
+ List<IPapyrusDecoration> decorations = decorationService.getDecorations(view.getElement(), false);
if((decorations != null) && (decorations.size() > 0)) {
if(view instanceof Edge) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
index 16974a0e1e9..33a36f69640 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
@@ -52,6 +52,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
@@ -284,7 +285,7 @@ public class AspectUnspecifiedTypeConnectionTool extends UnspecifiedTypeConnecti
listener = new NotificationListener() {
public void notifyChanged(Notification notification) {
- Connector newValue = (Connector)notification.getNewValue();
+ Edge newValue = (Edge)notification.getNewValue();
EditPart editPart = (EditPart)getCurrentViewer().getEditPartRegistry().get(newValue);
for(IAspectAction action : postActions) {
action.run(editPart);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
index 5eaf1fe94e9..57c1d88e654 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
@@ -46,7 +46,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
index cf877615b7a..569946a242f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
@@ -58,7 +58,8 @@ Require-Bundle: org.eclipse.emf.ecore,
org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
index 4d134dd0690..abe1686f99c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
@@ -13,13 +13,14 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.emftree;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.diagram.common.handler.CreateDiagramHandler;
public class CreateEMFTreeDiagramHandler extends CreateDiagramHandler {
@Override
- protected void addNewDiagram() {
- addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null);
+ protected void addNewDiagram(ServicesRegistry registry) {
+ addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null, registry);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
index c25947a78b5..e78ca24bcbe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
@@ -161,7 +161,6 @@ public class UMLEditor extends org.eclipse.uml2.uml.editor.presentation.UMLEdito
@Override
public void init(IEditorSite site, IEditorInput editorInput) {
- System.out.println(this.getClass().getSimpleName() + ".init()");
super.init(site, editorInput);
setPartName("emf tree");
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
index 28e2db65643..56348e0d539 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
@@ -17,7 +17,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
index 11b197c3f92..be7050ae4fb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
@@ -8,7 +8,7 @@
contentProvider="org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramContentProvider"
icon="icon/diagrams.gif"
id="org.eclipse.papyrus.views.modelexplorer.DiagramNavigatorContent"
- labelProvider="org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramLabelProvider"
+ labelProvider="org.eclipse.jface.viewers.LabelProvider"
name="Diagram Model Contents"
priority="lower">
<triggerPoints>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
index 249e06a42a1..1d94500b840 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
@@ -16,11 +16,14 @@ package org.eclipse.papyrus.uml.diagram.modelexplorer.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
import org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramContentProvider;
-import org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramLabelProvider;
-import org.eclipse.papyrus.views.modelexplorer.DecoratingLabelProviderWTooltips;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ToolItem;
@@ -55,13 +58,20 @@ public class DiagramViewHandler extends AbstractHandler {
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
+ ILabelProvider labelProvider;
+ try {
+ labelProvider = ServiceUtilsForHandlers.getInstance().getService(LabelProviderService.class, event).getLabelProvider();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ labelProvider = new LabelProvider();
+ }
+
if(((ToolItem)((Event)event.getTrigger()).widget).getSelection()) {
getCommonNavigator().getCommonViewer().setContentProvider(new DiagramContentProvider());
- getCommonNavigator().getCommonViewer().setLabelProvider(new DiagramLabelProvider());
} else {
getCommonNavigator().getCommonViewer().setContentProvider(new MoDiscoContentProvider());
- getCommonNavigator().getCommonViewer().setLabelProvider(new DecoratingLabelProviderWTooltips(new MoDiscoLabelProvider()));
}
+ getCommonNavigator().getCommonViewer().setLabelProvider(labelProvider);
getCommonNavigator().getCommonViewer().refresh();
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
index c0e64978f55..869cf98acbc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
@@ -22,7 +22,6 @@ import org.eclipse.papyrus.infra.core.resource.ModelUtils;
import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
/**
@@ -31,6 +30,7 @@ import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
*
*/
//TODO : This ContentProvider should extend SemanticUMLContentProvider
+@Deprecated
public class DiagramContentProvider extends MoDiscoContentProvider {
@Override
@@ -82,8 +82,9 @@ public class DiagramContentProvider extends MoDiscoContentProvider {
result.add((EObject)pageMngr.allPages().get(i));
}
}
+
EObject[] eObject = new EObject[result.size()];
- return NotationUtils.getNotationModel().getResource().getContents().toArray(eObject);
+ return result.toArray(eObject);
} catch (Exception e) {
Activator.log.error(e);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java
deleted file mode 100644
index 37a150ef984..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * 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.uml.diagram.modelexplorer.provider;
-
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * the label provider that inherits of modisco label provider
- *
- */
-public class DiagramLabelProvider extends MoDiscoLabelProvider {
-
- /** icon registry */
- private IPageIconsRegistry editorRegistry=null;
-
- /**
-
- /**
- * Get the EditorRegistry used to create editor instances. This default
- * implementation return the singleton eINSTANCE. This method can be
- * subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- * @throws ServiceException
- */
- @Override
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- * @throws ServiceException
- */
- @Override
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each
- // request.
- return new PageIconsRegistry();
- }
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- String text = super.getText(element);
- if(element instanceof Diagram) {
- Diagram diagram = (Diagram)element;
- if(diagram.getElement() instanceof NamedElement){
- text = text +" [" +((NamedElement)diagram.getElement()).getQualifiedName()+"]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return text;
- }
-
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
index 406abd20198..2ac1131b6d1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
@@ -23,29 +23,33 @@ import org.eclipse.uml2.uml.UMLPackage;
public class UMLNavigationHelper {
public static final String BEHAVIORAL_NAVIGATION = "Behavioral";
+
public static final String STRUCTURAL_NAVIGATION = "Structural";
@SuppressWarnings("serial")
- private static HashMap<EStructuralFeature, String> featureNavigationTypeMap = new HashMap<EStructuralFeature, String >() {{
- put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__CLASSIFIER_BEHAVIOR, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.CALL_BEHAVIOR_ACTION__BEHAVIOR, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.BEHAVIORAL_FEATURE__METHOD, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__ENTRY, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__DO_ACTIVITY, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__EXIT, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.TRANSITION__EFFECT, BEHAVIORAL_NAVIGATION);
-
- put(UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, STRUCTURAL_NAVIGATION);
- put(UMLPackage.Literals.ELEMENT__OWNED_ELEMENT, STRUCTURAL_NAVIGATION);
- put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__OWNED_BEHAVIOR, STRUCTURAL_NAVIGATION);
- }};
+ private static HashMap<EStructuralFeature, String> featureNavigationTypeMap = new HashMap<EStructuralFeature, String>() {
+
+ {
+ put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__CLASSIFIER_BEHAVIOR, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.CALL_BEHAVIOR_ACTION__BEHAVIOR, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.BEHAVIORAL_FEATURE__METHOD, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__ENTRY, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__DO_ACTIVITY, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__EXIT, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.TRANSITION__EFFECT, BEHAVIORAL_NAVIGATION);
+
+ put(UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, STRUCTURAL_NAVIGATION);
+ put(UMLPackage.Literals.ELEMENT__OWNED_ELEMENT, STRUCTURAL_NAVIGATION);
+ put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__OWNED_BEHAVIOR, STRUCTURAL_NAVIGATION);
+ }
+ };
public static String getNavigationType(NavigableElement navElement) {
return getNavigationTypeFromFeature(navElement.getFeature());
}
public static String getNavigationTypeFromFeature(EStructuralFeature feature) {
- if (feature == null) {
+ if(feature == null) {
// no feature specified, report structural
// because it is the root element
return STRUCTURAL_NAVIGATION;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
index 17f9ccd06d7..fb7f3c08c00 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ASCII"?>
<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" name="SequenceNotation">
- <tabs label="Appearance" id="appearance" category="org.eclipse.papyrus" priority="10">
+ <tabs label="Appearance" id="appearance" category="org.eclipse.papyrus" priority="75">
<sections name="CombinedFragmentTitle" sectionFile="ui/CombinedFragmentTitle.xwt">
<widget href="ui/CombinedFragmentTitle.xwt#/"/>
</sections>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
index 452b9acc460..4ca16a4d41f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
@@ -61,7 +61,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.papyrus.infra.extendedtypes;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
index 8edf4f75977..9fc380c0405 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
@@ -66,7 +66,7 @@ public abstract class ChangeShapeHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final GraphicalEditPart editPart = getSelectedGraphicalEditpart();
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers util = ServiceUtilsForActionHandlers.getInstance();
try {
transactionalEditingDomain = util.getTransactionalEditingDomain();
} catch (Exception e) {
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
index 427a2f6421f..141f5ab11fd 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
@@ -10,8 +10,14 @@
<modelqueryset file="resource/PapyrusBrowserQuery.querySet"/>
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent activeByDefault="true" contentProvider="org.eclipse.papyrus.uml.modelexplorer.UMLContentProvider" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif" id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent"
- labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider" name="UML Model Contents" priority="lower">
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.papyrus.uml.tools.providers.UMLContentProvider"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
+ id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent"
+ labelProvider="org.eclipse.jface.viewers.LabelProvider"
+ name="UML Model Contents"
+ priority="lower">
<triggerPoints>
<or>
<instanceof value="org.eclipse.emf.ecore.EObject">
@@ -122,7 +128,7 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.ArtifactHandler" description="Create a new Artifact" id="org.eclipse.papyrus.uml.modelexplorer.ArtifactCreateCommand" name="Create a new Artifact">
</command>
- <!-- Creation command for AssociationBase -->
+ <!-- Creation command for AssociationBase -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.AssociationBaseHandler" description="Create a new AssociationBase" id="org.eclipse.papyrus.uml.modelexplorer.AssociationBaseCreateCommand" name="Create a new AssociationBase">
</command>
@@ -290,8 +296,8 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestroyObjectActionHandler" description="Create a new DestroyObjectAction" id="org.eclipse.papyrus.uml.modelexplorer.DestroyObjectActionCreateCommand" name="Create a new DestroyObjectAction">
</command>
- <!-- Creation command for DestructionOccurrenceSpecification -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestructionOccurrenceSpecificationHandler" description="Create a new DestructionOccurrenceSpecification" id="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" name="Create a new DestructionOccurrenceSpecification">
+ <!-- Creation command for DestructionOccurrenceSpecification -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestructionOccurrenceSpecificationHandler" description="Create a new DestructionOccurrenceSpecification" id="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" name="Create a new DestructionOccurrenceSpecification">
</command>
<!-- Creation command for Device -->
@@ -386,10 +392,10 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GateHandler" description="Create a new Gate" id="org.eclipse.papyrus.uml.modelexplorer.GateCreateCommand" name="Create a new Gate">
</command>
- <!-- Creation command for GeneralOrdering -->
+ <!-- Creation command for GeneralOrdering -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GeneralOrderingHandler" description="Create a new GeneralOrdering" id="org.eclipse.papyrus.uml.modelexplorer.GeneralOrderingCreateCommand" name="Create a new GeneralOrdering">
- </command>
-
+ </command>
+
<!-- Creation command for Generalization -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GeneralizationHandler" description="Create a new Generalization" id="org.eclipse.papyrus.uml.modelexplorer.GeneralizationCreateCommand" name="Create a new Generalization">
</command>
@@ -498,10 +504,10 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralNullHandler" description="Create a new LiteralNull" id="org.eclipse.papyrus.uml.modelexplorer.LiteralNullCreateCommand" name="Create a new LiteralNull">
</command>
- <!-- Creation command for LiteralReal -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralRealHandler" description="Create a new LiteralReal" id="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" name="Create a new LiteralReal">
- </command>
-
+ <!-- Creation command for LiteralReal -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralRealHandler" description="Create a new LiteralReal" id="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" name="Create a new LiteralReal">
+ </command>
+
<!-- Creation command for LiteralString -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralStringHandler" description="Create a new LiteralString" id="org.eclipse.papyrus.uml.modelexplorer.LiteralStringCreateCommand" name="Create a new LiteralString">
</command>
@@ -842,25 +848,25 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.VariableHandler" description="Create a new Variable" id="org.eclipse.papyrus.uml.modelexplorer.VariableCreateCommand" name="Create a new Variable">
</command>
- <!-- Creation command for Association -->
+ <!-- Creation command for Association -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.AssociationHandler" description="Create a new Association" id="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" name="Create a new Association">
- </command>
-
- <!-- Creation command for Trace -->
+ </command>
+
+ <!-- Creation command for Trace -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.TraceHandler" description="Create a new Trace" id="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" name="Create a new Trace">
- </command>
-
- <!-- Creation command for Refine -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.RefineHandler" description="Create a new Refine" id="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" name="Create a new Refine">
- </command>
-
+ </command>
+
+ <!-- Creation command for Refine -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.RefineHandler" description="Create a new Refine" id="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" name="Create a new Refine">
+ </command>
+
</extension>
<!-- UI Menu declaration for creation commands -->
<extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.createchild" allPopups="false">
+ <menuContribution allPopups="false" locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.createchild">
<!-- Creation menu action for Abstraction -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.AbstractionCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Abstraction" style="push" tooltip="Create a new Abstraction">
@@ -932,7 +938,7 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for AssociationBase -->
+ <!-- Creation menu action for AssociationBase -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationBaseCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new AssociationBase" style="push" tooltip="Create a new AssociationBase">
<visibleWhen checkEnabled="true"/>
</command>
@@ -1142,8 +1148,8 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for DestructionOccurrenceSpecification -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DestructionOccurrenceSpecification.gif" label="Create a new DestructionOccurrenceSpecification" style="push" tooltip="Create a new DestructionOccurrenceSpecification">
+ <!-- Creation menu action for DestructionOccurrenceSpecification -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DestructionOccurrenceSpecification.gif" label="Create a new DestructionOccurrenceSpecification" style="push" tooltip="Create a new DestructionOccurrenceSpecification">
<visibleWhen checkEnabled="true"/>
</command>
@@ -1262,11 +1268,11 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for GeneralOrdering -->
+ <!-- Creation menu action for GeneralOrdering -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.GeneralOrderingCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif" label="Create a new GeneralOrdering" style="push" tooltip="Create a new GeneralOrdering">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<!-- Creation menu action for Generalization -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.GeneralizationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif" label="Create a new Generalization" style="push" tooltip="Create a new Generalization">
<visibleWhen checkEnabled="true"/>
@@ -1402,11 +1408,11 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for LiteralReal -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralReal.gif" label="Create a new LiteralReal" style="push" tooltip="Create a new LiteralReal">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <!-- Creation menu action for LiteralReal -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralReal.gif" label="Create a new LiteralReal" style="push" tooltip="Create a new LiteralReal">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<!-- Creation menu action for LiteralString -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralStringCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralString.gif" label="Create a new LiteralString" style="push" tooltip="Create a new LiteralString">
<visibleWhen checkEnabled="true"/>
@@ -1832,31 +1838,28 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for Association -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new Association" style="push" tooltip="Create a new Association">
- <visibleWhen checkEnabled="true"/>
- </command>
-
- <!-- Creation menu action for Trace -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Trace" style="push" tooltip="Create a new Trace">
- <visibleWhen checkEnabled="true"/>
- </command>
-
- <!-- Creation menu action for Refine -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Refine" style="push" tooltip="Create a new Refine">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <!-- Creation menu action for Association -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new Association" style="push" tooltip="Create a new Association">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
+ <!-- Creation menu action for Trace -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Trace" style="push" tooltip="Create a new Trace">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
+ <!-- Creation menu action for Refine -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Refine" style="push" tooltip="Create a new Refine">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
</menuContribution>
</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.views.modelexplorer.Activator"/>
-</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.core.runtime.adapters">
<factory adaptableType="org.eclipse.emf.facet.infra.browser.uicore.internal.model.ModelElementItem" class="org.eclipse.papyrus.uml.modelexplorer.factory.ModelElementItemFactory">
<adapter type="org.eclipse.uml2.uml.NamedElement">
@@ -1869,12 +1872,12 @@
</facetset>
</extension>
<extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization file="resource/UMLFacetDefaultBrowserCustomization.uiCustom" loadByDefault="true"/>
+ <browserCustomization file="resource/NotationCustomization.uiCustom" loadByDefault="true">
+ </browserCustomization>
<browserCustomization
- file="resource/UMLFacetDefaultBrowserCustomization.uiCustom"
- loadByDefault="true"/>
- <browserCustomization
- file="resource/NotationCustomization.uiCustom"
- loadByDefault="true">
+ file="resource/UMLReadOnly.uiCustom"
+ loadByDefault="false">
</browserCustomization>
- </extension>
+ </extension>
</plugin>
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
deleted file mode 100644
index 353609e50bb..00000000000
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * 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.uml.modelexplorer;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.papyrus.uml.tools.model.UmlUtils;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * this is a specific content provider used to not display UML stereotype applications
- *
- * @deprecated Use {@link org.eclipse.papyrus.uml.tools.providers.UMLContentProvider} instead
- */
-@Deprecated
-public class UMLContentProvider extends MoDiscoContentProvider {
-
-
- /**
- * Return the initial values from the input.
- * Input should be of type {@link UmlModel}.
- *
- * @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelContentProvider#getRootElements(java.lang.Object)
- *
- * @param inputElement
- * @return
- */
- @Override
- protected EObject[] getRootElements(ModelSet modelSet) {
- UmlModel umlModel = (UmlUtils.getUmlModel(modelSet));
-
- if(umlModel == null)
- return null;
-
- EList<EObject> contents = umlModel.getResource().getContents();
- ArrayList<EObject> result = new ArrayList<EObject>();
- Iterator<EObject> iterator = contents.iterator();
- while(iterator.hasNext()) {
- EObject eObject = iterator.next();
- //functionality that comes from UML2 plugins
- if(UMLUtil.getStereotype(eObject) == null) {
- result.add(eObject);
- }
- }
- return result.toArray(new EObject[result.size()]);
- }
-}
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
index f0a12e7044e..22eed69833a 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
@@ -219,7 +219,7 @@ public abstract class AbstractCommandHandler extends AbstractHandler {
try {
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers util = ServiceUtilsForActionHandlers.getInstance();
creationcommand = getCommand();
util.getTransactionalEditingDomain().getCommandStack().execute(creationcommand);
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
index 6b9502549e8..296d5eb3eb5 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionExcep
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
/**
@@ -28,6 +27,6 @@ import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuer
public class GetDiagramIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<Diagram, String> {
public String evaluate(final Diagram context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
index 20cd8a3bcb4..65761a13689 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
@@ -9,7 +9,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.services.resourceloading.preferences;bundle-version="0.10.0",
org.eclipse.emf.validation.ocl;bundle-version="1.4.0",
org.eclipse.emf.validation.ui;bundle-version="1.3.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
index 3c76b04620a..23bb0622076 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
@@ -1,6 +1,7 @@
package org.eclipse.papyrus.uml.controlmode.profile;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.osgi.framework.BundleContext;
/**
@@ -14,6 +15,8 @@ public class Activator extends Plugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -29,6 +32,7 @@ public class Activator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
index 2ddf8f6bb69..007bf0d7501 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
@@ -15,7 +15,6 @@ package org.eclipse.papyrus.uml.controlmode.profile.validation;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -34,7 +33,8 @@ import org.eclipse.emf.validation.EMFEventType;
import org.eclipse.emf.validation.IValidationContext;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.services.resourceloading.preferences.StrategyChooser;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
import org.eclipse.papyrus.uml.controlmode.profile.Activator;
@@ -100,6 +100,7 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
* validation context
* @return validation status
*/
+ @Override
public IStatus validate(IValidationContext ctx) {
try {
if(ctx.equals(lastValidatedContext)) {
@@ -240,9 +241,17 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
boolean readOnlyPackages = false;
StringBuffer readOnlyPackagesList = new StringBuffer();
//Check if controlled package is loaded
- for(Iterator<Package> iterator = controlledPackages.iterator(); iterator.hasNext();) {
- Package pack = iterator.next();
- EditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ EditingDomain domain = null;
+ for(Package pack : controlledPackages) {
+ if(domain == null) {
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(pack);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return false;
+ }
+ }
+
if(pack.eIsProxy()) {
EObject loadedObject = domain.getResourceSet().getEObject(((InternalEObject)pack).eProxyURI(), true);
if(loadedObject != null) {
@@ -271,6 +280,7 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
}
}
}
+
//Report error if the controlled package is read-only
if(readOnlyPackages) {
String msg = NLS.bind(Messages.error_readonly, readOnlyPackagesList.toString());
diff --git a/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java b/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
index 8445fb0b0f4..50621e600a2 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.perspective;
import org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard;
import org.eclipse.papyrus.uml.diagram.wizards.NewPapyrusProjectWizard;
+import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
@@ -26,6 +27,8 @@ public class PapyrusPerspective implements IPerspectiveFactory {
/** constant for the definition of papyrus model explorer **/
protected static final String ID_MODELEXPLORER = "org.eclipse.papyrus.views.modelexplorer.modelexplorer";
+ public static final String ID_BOTTOM_FOLDER = "org.eclipse.papyrus.perspective.folder.bottom";
+
/**
*
* this method create the layout attached to this perspective
@@ -55,6 +58,8 @@ public class PapyrusPerspective implements IPerspectiveFactory {
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
layout.addShowViewShortcut(ID_MODELEXPLORER);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //Error log. //A constant doesn't seem to exist for this ID
layout.addActionSet("org.eclipse.debug.ui.launchActionSet");
@@ -84,8 +89,12 @@ public class PapyrusPerspective implements IPerspectiveFactory {
// place outline under the model explorer
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.BOTTOM, 0.5f, ID_MODELEXPLORER);
- // place properties under the editor
- layout.addView(IPageLayout.ID_PROP_SHEET, IPageLayout.BOTTOM, (float)0.70, editorArea);
+ // place properties and problem views under the editor
+ IFolderLayout bottomFolder = layout.createFolder(ID_BOTTOM_FOLDER, IPageLayout.BOTTOM, 0.70f, editorArea);
+
+ bottomFolder.addView(IPageLayout.ID_PROP_SHEET);
+ bottomFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+
// bottom.addView("org.eclipse.pde.runtime.LogView");
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
index ed71036b92f..4880e7d7c3c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
@@ -14,7 +14,7 @@ package org.eclipse.papyrus.uml.profile.providers;
import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
public class AppliedStereotypePropertyFilteredLabelProvider extends AppliedStereotypePropertyLabelProvider implements IFilteredLabelProvider {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
index 487bce355e2..49aefe756c4 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
@@ -23,7 +23,9 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.utils.Util;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Element;
@@ -58,7 +60,7 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
public Stereotype getParentStereotype() {
- return ((AppliedStereotypeTreeObject) getParent()).getStereotype();
+ return ((AppliedStereotypeTreeObject)getParent()).getStereotype();
}
/**
@@ -72,13 +74,13 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
/**
* Reinitialize the children from model, useful to reflect model changes in
- * the value tree.
+ * the value tree.
*/
- public void reInitChilds () {
- children.clear ();
- createChildren ();
+ public void reInitChilds() {
+ children.clear();
+ createChildren();
}
-
+
/**
* Creates the children.
*/
@@ -90,30 +92,29 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
return;
}
- if (value instanceof EList) {
+ if(value instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> values = (EList<Object>) value;
+ EList<Object> values = (EList<Object>)value;
Iterator<Object> it = values.iterator();
while(it.hasNext()) {
final Object currentValue = it.next();
ValueTreeObject vTO = createValueTreeObject(currentValue);
addChild(vTO);
}
- }
- else {
+ } else {
ValueTreeObject vTO = createValueTreeObject(value);
addChild(vTO);
}
}
/**
- * Returns the value of the stereotype attribute
+ * Returns the value of the stereotype attribute
*
* @return the value
*/
public Object getValue() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
- StereotypedElementTreeObject rTO = (StereotypedElementTreeObject) sTO.getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
+ StereotypedElementTreeObject rTO = (StereotypedElementTreeObject)sTO.getParent();
Stereotype st = sTO.getStereotype();
Element elt = rTO.getElement();
@@ -121,8 +122,8 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
public Element getElement() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
- StereotypedElementTreeObject rTO = (StereotypedElementTreeObject) sTO.getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
+ StereotypedElementTreeObject rTO = (StereotypedElementTreeObject)sTO.getParent();
return rTO.getElement();
}
@@ -134,9 +135,9 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
public EObject getStereotypeApplication() {
return getElement().getStereotypeApplication(getStereotype());
}
-
+
public Stereotype getStereotype() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
return sTO.getStereotype();
}
@@ -180,26 +181,28 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
return vTO;
}
-
+
/**
* This function is used prior to updating the model. It will add the new value to the
* list of existing values, in case of a multi-valued property. editMe methods should call
* this method before calling update.
- * @param newValue a new value for the property (must not be a list itself)
+ *
+ * @param newValue
+ * a new value for the property (must not be a list itself)
* @return a new list which the existing stereotype value and the newValue in case of
- * a multi-value property or the newValue, if not multi-valued
+ * a multi-value property or the newValue, if not multi-valued
*/
- public Object appendMV (Object newValue) {
-
- Stereotype stereotype = ((AppliedStereotypeTreeObject) getParent()).getStereotype();
- Element element = ((StereotypedElementTreeObject) getParent().getParent()).getElement();
+ public Object appendMV(Object newValue) {
+
+ Stereotype stereotype = ((AppliedStereotypeTreeObject)getParent()).getStereotype();
+ Element element = ((StereotypedElementTreeObject)getParent().getParent()).getElement();
- if (property.isMultivalued ()) {
+ if(property.isMultivalued()) {
// add to existing contents
Object existingValue = element.getValue(stereotype, property.getName());
- if (existingValue instanceof EList) {
+ if(existingValue instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> existingValueList = (EList<Object>) existingValue;
+ EList<Object> existingValueList = (EList<Object>)existingValue;
EList<Object> valueList = new BasicEList<Object>();
valueList.addAll(existingValueList);
valueList.add(newValue);
@@ -208,26 +211,29 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
return newValue;
}
-
+
/**
* Remove elements from the list of proposed stereotype values that have already
- * selected - except the currently selected element.
- * @param proposalList the list of possible stereotype values
- * @param oldValue the currently selected value
+ * selected - except the currently selected element.
+ *
+ * @param proposalList
+ * the list of possible stereotype values
+ * @param oldValue
+ * the currently selected value
*/
- protected <T extends Object> void removeSelected (List<T> proposalList, T oldValue) {
- if (property.isMultivalued()) {
+ protected <T extends Object> void removeSelected(List<T> proposalList, T oldValue) {
+ if(property.isMultivalued()) {
@SuppressWarnings("unchecked")
- EList<EObject> values = (EList<EObject>) getValue();
- if (values != null) {
+ EList<EObject> values = (EList<EObject>)getValue();
+ if(values != null) {
proposalList.removeAll(values);
}
- if (oldValue != null) {
- proposalList.add (oldValue);
+ if(oldValue != null) {
+ proposalList.add(oldValue);
}
}
}
-
+
/**
* Update value by means of a command that is executed within the Papyrus
* editing domain.
@@ -238,7 +244,14 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
public void updateValue(final Object newValue) {
// use domain to update the value
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(property);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
RecordingCommand command = new RecordingCommand(domain, "Edit Stereotype Property Value") {
/**
@@ -246,8 +259,8 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
*/
@Override
protected void doExecute() {
- Stereotype stereotype = ((AppliedStereotypeTreeObject) getParent()).getStereotype();
- Element element = ((StereotypedElementTreeObject) getParent().getParent()).getElement();
+ Stereotype stereotype = ((AppliedStereotypeTreeObject)getParent()).getStereotype();
+ Element element = ((StereotypedElementTreeObject)getParent().getParent()).getElement();
Property property = getProperty();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
index b4e8e1e9427..0816cfb5ce8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.0",
org.eclipse.gef;bundle-version="3.7.1",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.properties.tabbedproperties.comments,
org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection
Bundle-Vendor: %providerName
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
index ba1fc31c8db..c7248c68e8e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
@@ -103,6 +103,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @{inheritDoc
*/
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
// remove the OK button as default button, so Carriage Return key pressed does not close the dialog
@@ -123,7 +124,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*
- *@param parent
+ * @param parent
* the parent composite to contain the dialog area
* @return the dialog area control
*/
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
index 3ddfaae6cb3..cfa166b103c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
@@ -63,7 +63,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
import org.eclipse.papyrus.uml.diagram.common.parser.HTMLCleaner;
@@ -185,7 +187,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// creates the rich text editor content
richText = CommentRichTextFormToolkit.createFocusAwareRichTextEditor(getWidgetFactory(), mainComposite, "", comment, //$NON-NLS-1$
- SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
data = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
data.heightHint = 240;
richText.setLayoutData(data);
@@ -350,7 +352,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// this is the real element, not a ghost one. display it in the list
if(!isProxy) {
- if(comment.getAnnotatedElements().contains((Element)inputElement)) {
+ if(comment.getAnnotatedElements().contains(inputElement)) {
annotatedElements.add(comment);
}
}
@@ -394,6 +396,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
/**
* {@inheritDoc}
*/
+ @Override
public String getText(Object element) {
if(element instanceof Comment) {
String body = ((Comment)element).getBody();
@@ -476,7 +479,14 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
final Element element = getElement();
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -542,7 +552,13 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
}
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -680,7 +696,15 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
IAdaptable sourceAdapter = (IAdaptable)((List)request.getNewObject()).get(0);
IAdaptable targetAdapter = new SemanticAdapter(null, selectionEditPart.getModel());
- CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(EditorUtils.getTransactionalEditingDomain(), selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(domain, selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
CompositeCommand compoundCommand = new CompositeCommand("Display Comment with link");
compoundCommand.compose(new CommandProxy(createCommand));
compoundCommand.compose(linkVisualIDCommand);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
index 21ec160cd60..2f2cc57e139 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
@@ -13,7 +13,8 @@ package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysec
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -40,6 +41,7 @@ public class FocusAwareCommentRichText extends CommentRichText {
/**
* Adds listeners to manage the activation and focus events.
*/
+ @Override
protected void addListeners() {
editorControl = getControlSite(editor);
@@ -80,7 +82,14 @@ public class FocusAwareCommentRichText extends CommentRichText {
return;
}
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(getComment());
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
index 0da4c022584..69012b17005 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
@@ -310,7 +311,12 @@ public class AppearanceForAppliedStereotypeComposite extends org.eclipse.papyrus
}
public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (Exception ex){
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
index 4b191db4943..f94c0271d15 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -117,6 +118,7 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
* @return the selected
* @deprecated
*/
+ @Deprecated
@Override
public Element getSelected() {
return getElement();
@@ -144,8 +146,8 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
return;
}
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -154,15 +156,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -180,8 +182,11 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
if(diagramElement == null) {
return;
}
+
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+
try {
- getDomain().runExclusive(new Runnable() {
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -189,15 +194,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
+ RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
index d103b330db5..9ad99de8679 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.swt.SWT;
@@ -61,32 +62,33 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
protected void touchModel() {
// CommandSupport.exec ("update stereotype", /* command)
- if (currentView == null) {
+ if(currentView == null) {
return;
}
-
+
try {
- getDomain().runExclusive(new Runnable() {
-
+ final TransactionalEditingDomain domain = getEditingDomain(currentView);
+ domain.runExclusive(new Runnable() {
+
public void run() {
- Display.getCurrent().asyncExec( new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
public void run() {
String localization = AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(currentView);
- RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(getDomain(), currentView, localization);
+ RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(domain, currentView, localization);
+
+ domain.getCommandStack().execute(command);
- getDomain().getCommandStack().execute(command);
-
}
});
-
+
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -97,7 +99,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void addButtonPressed() {
super.addButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -107,7 +109,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void removeButtonPressed() {
super.removeButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -117,7 +119,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void upButtonPressed() {
super.upButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -127,7 +129,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void downButtonPressed() {
super.downButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -136,7 +138,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
@Override
protected void createPropTree() {
super.createPropTree();
- getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener (treeViewer, stereotypeComposite, this));
+ getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener(treeViewer, stereotypeComposite, this));
}
/**
@@ -152,6 +154,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
/**
*
*/
+ @Override
public void disposeListeners() {
super.disposeListeners();
stereotypeComposite.disposeListeners();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
index 143a89865ad..b1036c6691c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
@@ -36,7 +36,8 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
@@ -91,8 +92,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
private CLabel appliedLabel;
- private TransactionalEditingDomain domain;
-
/**
* the factory to create elements
*/
@@ -154,14 +153,16 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void applyProfile(final Package thepackage, final Profile profile, final boolean withSubProfiles) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -425,8 +426,13 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -549,10 +555,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public void setDomain(TransactionalEditingDomain domain) {
- this.domain = domain;
- }
-
/**
* Sets the selection.
*
@@ -573,14 +575,15 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void unApplyProfile(final Package thepackage, final Profile profile) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
-
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
index 989dd6ba598..6408aa9c467 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
@@ -26,7 +26,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.preference.ProfilePreferenceConstants;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
@@ -59,8 +60,13 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @return the domain
*/
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/** The panel that display applied stereotypes. */
@@ -272,8 +278,8 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @param propertyView
*/
- public void refreshTreeViewer () {
- treeViewer.refresh ();
+ public void refreshTreeViewer() {
+ treeViewer.refresh();
}
/**
@@ -428,15 +434,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void applyStereotype(final Element elt, final Stereotype st) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -466,15 +472,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
protected void unapplyStereotype(final Element elt, final Stereotype st) {
// bugfix: a selected element is not necessary a diagram element (ex: selection in the outline)
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -504,15 +510,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void reorderStereotypeApplications(final Element element, final EList stereotypes) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(element);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
index 37ca929d9b6..22737da2527 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
@@ -18,8 +18,10 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import java.util.ArrayList;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Message;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementLabelProvider;
@@ -27,6 +29,7 @@ import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTre
import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypeTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.StereotypedElementTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject;
+import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;
@@ -41,9 +44,13 @@ import org.eclipse.uml2.uml.Stereotype;
*/
public class PropertyComposite extends DecoratedTreeComposite {
- public TransactionalEditingDomain getDomain() {
- // used by heir AppliedStereotypePropertyCompositeWithView
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(EModelElement context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -56,7 +63,7 @@ public class PropertyComposite extends DecoratedTreeComposite {
super(parent, SWT.NONE, "Property values", false);
}
-
+
/*
* (non-Javadoc)
*
@@ -131,12 +138,12 @@ public class PropertyComposite extends DecoratedTreeComposite {
}
- public void itemDClicked () {
+ public void itemDClicked() {
AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
// re-initialize value tree objects (model is already updated, value in tree object is not)
pTO.reInitChilds();
}
-
+
/**
* Action triggered when the add button is pressed.
*/
@@ -160,10 +167,10 @@ public class PropertyComposite extends DecoratedTreeComposite {
// if lower multiplicity is equal to upper multiplicity : cannot add
if(lower == upper && pTO.getValue() != null) {
- if (pTO.getValue() instanceof EList) {
+ if(pTO.getValue() instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) pTO.getValue ();
- if (currentValues.size() >= upper) {
+ EList<Object> currentValues = (EList<Object>)pTO.getValue();
+ if(currentValues.size() >= upper) {
Message.warning("Multiplicity of this property is " + property.getLower() + ".." + property.getUpper() + "\n" + "Impossible to add a new value.");
return;
}
@@ -176,29 +183,28 @@ public class PropertyComposite extends DecoratedTreeComposite {
// Retrieve current value
ArrayList<Object> currentPropertyValues = new ArrayList<Object>();
Object currentValue = pTO.getValue();
- if (currentValue != null) {
-
+ if(currentValue != null) {
+
if(upper == 1) {
currentPropertyValues.add(currentValue);
} else { // if (upper != 1) {
-
+
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentValue;
+ EList<Object> currentValues = (EList<Object>)currentValue;
for(int i = 0; i < currentValues.size(); i++) {
currentPropertyValues.add(currentValues.get(i));
}
}
}
- if (property.isMultivalued() || (currentPropertyValues.size() < upper)) {
- ValueTreeObject.createInstance(pTO, null).editMe ();
- }
- else {
+ if(property.isMultivalued() || (currentPropertyValues.size() < upper)) {
+ ValueTreeObject.createInstance(pTO, null).editMe();
+ } else {
Message.warning("Upper multiplicity of " + property.getName() + " is " + property.getUpper());
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
/**
@@ -213,9 +219,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
TreeItem[] items = getTree().getSelection();
for(int i = 0; i < nbrOfSelection; i++) {
- ValueTreeObject vTO = (ValueTreeObject) items[i].getData();
- AppliedStereotypePropertyTreeObject pTO =
- (AppliedStereotypePropertyTreeObject) treeViewer.getInput();
+ ValueTreeObject vTO = (ValueTreeObject)items[i].getData();
+ AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
Property property = pTO.getProperty();
int lower = property.getLower();
@@ -230,25 +235,25 @@ public class PropertyComposite extends DecoratedTreeComposite {
Object currentVal = pTO.getValue();
ArrayList<Object> tempValues = new ArrayList<Object>();
- if (upper != 1) {
+ if(upper != 1) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentVal;
- tempValues.addAll (currentValues);
-
- if (tempValues.size() > lower) {
+ EList<Object> currentValues = (EList<Object>)currentVal;
+ tempValues.addAll(currentValues);
+
+ if(tempValues.size() > lower) {
tempValues.remove(vTO.getValue());
}
}
-
+
if(property.isMultivalued()) {
// setPropertiesValue(selectedElt, stereotype, property, tempValues);
- pTO.updateValue (tempValues);
+ pTO.updateValue(tempValues);
} else {
- pTO.updateValue (null);
+ pTO.updateValue(null);
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
}
@@ -315,8 +320,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
*/
public void setInput(AppliedStereotypePropertyTreeObject element) {
treeViewer.setInput(element);
- if (element != null) {
- element.reInitChilds ();
+ if(element != null) {
+ element.reInitChilds();
}
refresh();
}
@@ -339,4 +344,4 @@ public class PropertyComposite extends DecoratedTreeComposite {
public void editItem(TreeItem item) {
// do nothing
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
index 7cfb418a0e6..1e7c488c883 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
@@ -21,7 +21,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.properties.profile.ui.compositeforview.AppliedProfileCompositeWithView;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
@@ -62,6 +61,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void refresh() {
appliedProfileComposite.refresh();
}
@@ -70,6 +70,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
if(selection instanceof IStructuredSelection) {
@@ -86,8 +87,6 @@ public class AppliedProfileSection extends AbstractPropertySection {
appliedProfileComposite.setSelection(selection);
}
}
-
- appliedProfileComposite.setDomain(EditorUtils.getTransactionalEditingDomain());
}
}
@@ -113,9 +112,11 @@ public class AppliedProfileSection extends AbstractPropertySection {
/**
*
*/
+ @Override
public void dispose() {
super.dispose();
- if(appliedProfileComposite != null)
+ if(appliedProfileComposite != null) {
appliedProfileComposite.disposeListeners();
+ }
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
index c73fee5ce42..3464717550c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
@@ -14,6 +14,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -21,8 +22,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
@@ -266,14 +265,13 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
@@ -418,6 +416,7 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
/**
* {@inheritDoc}
*/
+ @Override
public void dispose() {
if(comboStereotypeAppearance != null && !comboStereotypeAppearance.isDisposed()) {
comboStereotypeAppearance.removeSelectionListener(comboStereotypeAppearanceListener);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
index d4c6bf43a3f..5e89a1702bc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
@@ -10,8 +11,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.swt.SWT;
@@ -132,12 +131,14 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
*
* {@inheritDoc}
*/
+ @Override
public void dispose() {
super.dispose();
diagramElement.eAdapters().remove(this);
- if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed())
+ if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed()) {
comboStereotypePropertiesPlace.removeSelectionListener(comboStereotypePropertiesPlaceListener);
+ }
}
/**
@@ -175,14 +176,13 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
index b6e15f1c61c..5f5c0b99ddd 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
@@ -20,7 +20,8 @@ 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.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement;
@@ -132,8 +133,16 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
if(getElement() instanceof Image) {
final File imgFile = new File(iconSelected);
+ Image image = (Image)getElement();
+
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
/**
@@ -159,9 +168,15 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
protected void removeAction() {
// Erase image content
if(getElement() instanceof Image) {
-
- TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
+ Image image = (Image)getElement();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Remove Image content", null) {
/**
* {@inheritDoc}
@@ -177,7 +192,7 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
}
};
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
index 1844704e90a..e60159f8b48 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
@@ -17,7 +17,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.common.xtext;bundle-version="0.
org.antlr.runtime,
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.apache.log4j;bundle-version="1.2.15",
- org.eclipse.uml2.uml
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
index 61fb426abe3..da78ce6a0f0 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
@@ -6,6 +6,7 @@ package org.eclipse.papyrus.uml.textedit.common.xtext.ui.contentassist;
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
@@ -15,7 +16,11 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.DisplayUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.uml.textedit.common.xtext.ui.internal.UmlCommonActivator;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.MultiplicityRule;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.QualifiedName;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
@@ -38,7 +43,7 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
/** the label provider */
- protected ILabelProvider labelProvider = DisplayUtils.getLabelProvider();
+ protected ILabelProvider labelProvider;
/** the edited model */
private Namespace model = null;
@@ -81,7 +86,7 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
/**
*
- * This method initializes the fields {@link #model} {@link #contextElement} thanks to the current selection
+ * This method initializes the fields {@link #model} {@link #contextElement} {@link #labelProvider} thanks to the current selection
*
*/
protected void initModel() {
@@ -104,6 +109,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
}
}
}
+
+ try {
+ labelProvider = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, model).getLabelProvider();
+ } catch (ServiceException ex) {
+ Logger.getLogger(UmlCommonActivator.class).error(ex);
+ labelProvider = new LabelProvider();
+ }
+
Assert.isNotNull(contextElement, "I can't find the edited element"); //$NON-NLS-1$
Assert.isNotNull(this.model, "I can't find the model owning the edited element"); //$NON-NLS-1$
}
@@ -355,14 +368,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')'; //$NON-NLS-1$ //$NON-NLS-2$
ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset(), // Offset
- context.getSelectedText().length(), // Replacement length
- completionString.length(), // cursorPosition
- labelProvider.getImage(namedElement), // image
- " " + displayString, // displayString //$NON-NLS-1$
- null, // contextInformation
- additionalProposalInfo // additionalProposalInfo
- );
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement), // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ additionalProposalInfo // additionalProposalInfo
+ );
return completionProposal;
}
@@ -380,14 +393,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
protected ICompletionProposal createCompletionProposal(String completionString, String displayString, ContentAssistContext context) {
ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset(), // Offset
- context.getSelectedText().length(), // Replacement length
- completionString.length(), // cursorPosition
- null, // image
- " " + displayString, // displayString //$NON-NLS-1$
- null, // contextInformation
- null // additionalProposalInfo
- );
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ null, // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ null // additionalProposalInfo
+ );
return completionProposal;
}
@@ -409,14 +422,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')'; //$NON-NLS-1$ //$NON-NLS-2$
ICompletionProposal completionProposal = new CompletionProposal(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 //$NON-NLS-1$
- null, // contextInformation
- additionalProposalInfo // additionalProposalInfo
- );
+ context.getOffset() - context.getPrefix().length(), // Offset
+ context.getPrefix().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement), // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ additionalProposalInfo // additionalProposalInfo
+ );
return completionProposal;
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
index a1b22b35e25..3bc28801dfa 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
@@ -18,7 +18,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.services.validation;bundle-version="0.10.0",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.tools,
org.eclipse.papyrus.uml.tools.commands,
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
index ebebb793dfc..6f24f4c45bf 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
@@ -57,7 +57,7 @@ public class ProfileApplicationObservableList extends WritableList implements IC
* The editing domain on which the commands are executed
*/
public ProfileApplicationObservableList(Package umlSource, EditingDomain domain) {
- super(new LinkedList<Object>(umlSource.getAllAppliedProfiles()), Profile.class);
+ super(new LinkedList<Object>(umlSource.getAppliedProfiles()), Profile.class);
this.umlSource = umlSource;
this.domain = domain;
commands = new LinkedList<Command>();
@@ -188,7 +188,7 @@ public class ProfileApplicationObservableList extends WritableList implements IC
private void refreshCacheList() {
wrappedList.clear();
- wrappedList.addAll(umlSource.getAllAppliedProfiles());
+ wrappedList.addAll(umlSource.getAppliedProfiles());
fireListChange(null);
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
index 49c5b757abf..c50adafd18f 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
@@ -17,15 +17,20 @@ import java.util.Collections;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.emf.providers.EMFEnumeratorContentProvider;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
+import org.eclipse.papyrus.uml.tools.Activator;
import org.eclipse.papyrus.uml.tools.util.UMLProviderHelper;
import org.eclipse.papyrus.uml.tools.utils.ProfileUtil;
import org.eclipse.uml2.uml.InstanceValue;
@@ -47,6 +52,44 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
protected ResourceSet root;
+ public UMLContentProvider() {
+ //Empty (@see #setInput())
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ IStructuredContentProvider semanticProvider = null;
+
+ if(newInput instanceof EObject) {
+ EObject eObject = (EObject)newInput;
+ semanticProvider = getSemanticProvider(eObject);
+ }
+
+ if(newInput instanceof Resource) {
+ semanticProvider = getSemanticProvider((Resource)newInput);
+ }
+
+ if(newInput instanceof ResourceSet) {
+ root = (ResourceSet)newInput;
+ semanticProvider = getSemanticProvider(root);
+ }
+
+ if(newInput instanceof ServicesRegistry) {
+ try {
+ root = ServiceUtils.getInstance().getModelSet((ServicesRegistry)newInput);
+ semanticProvider = getSemanticProvider(root);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ if(semanticProvider != null) {
+ encapsulated = UMLProviderHelper.encapsulateProvider(semanticProvider, null, feature, root);
+ }
+
+ super.inputChanged(viewer, oldInput, newInput);
+ }
+
/**
* Constructor.
*
@@ -99,6 +142,18 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
encapsulated = UMLProviderHelper.encapsulateProvider(semanticProvider, eObject, feature, root);
}
+ protected IStructuredContentProvider getSemanticProvider(ResourceSet root) {
+ return new SemanticUMLContentProvider(root);
+ }
+
+ protected IStructuredContentProvider getSemanticProvider(Resource root) {
+ return new SemanticUMLContentProvider(root.getContents().toArray(new EObject[0]));
+ }
+
+ protected IStructuredContentProvider getSemanticProvider(EObject root) {
+ return new SemanticUMLContentProvider(new EObject[]{ root });
+ }
+
/**
*
* @param source
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
index da13e453ce1..ad96345f04d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
@@ -16,7 +16,7 @@ import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.uml2.uml.Element;
/**
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
index 74b8a978239..156013c2353 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
@@ -3,12 +3,6 @@ package org.eclipse.papyrus.uml.tools.providers;
import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.uml.tools.Activator;
@@ -46,9 +40,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
/** icon for metaclass */
public static final String ICON_METACLASS = "/icons/Metaclass.gif";//$NON-NLS-1$
- /** icon for a compartment */
- public static final String ICON_COMPARTMENT = "/icons/none_comp_vis.gif"; //$NON-NLS-1$
-
/**
*
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
@@ -83,11 +74,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
return image == null ? super.getImage(element) : image;
}
- // if the element is a compartment
- if(element instanceof BasicCompartment || element instanceof DecorationNode) {
- return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, ICON_COMPARTMENT);
- }
-
return super.getImage(element);
}
@@ -264,11 +250,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
// when the element is not a NamedElement, we return its Type name
String className = element.eClass().getName();
return className;
- } else if(element instanceof View) { // maybe it is a view of a compartment
- EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View)element);
- if(dummyEP instanceof ResizableCompartmentEditPart) {
- return ((ResizableCompartmentEditPart)dummyEP).getCompartmentName();
- }
}
return super.getText(element);
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
index e0bce2f435d..506b983cffb 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
@@ -17,10 +17,10 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
import org.eclipse.papyrus.uml.tools.providers.UMLContainmentBrowseStrategy;
@@ -42,7 +42,12 @@ public class UMLProviderHelper {
* @return
*/
public static EMFGraphicalContentProvider encapsulateProvider(IStructuredContentProvider provider, EObject editedEObject, EStructuralFeature feature, ResourceSet root) {
- String historyId = HistoryUtil.getHistoryID(editedEObject, feature);
+ String historyId;
+ if(editedEObject != null && feature != null) {
+ historyId = HistoryUtil.getHistoryID(editedEObject, feature);
+ } else {
+ historyId = "DefaultHistory";
+ }
IStructuredContentProvider contentProvider;
diff --git a/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF b/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF
index ee8aff2c356..06e502642f4 100644
--- a/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF
+++ b/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.papyrus.views.documentation.view;bundle-version="0.1
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-Version: 0.10.0.qualifier
Bundle-Name: %pluginName
diff --git a/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java b/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
index 0b8d5bebc37..cb45225a5e7 100644
--- a/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
+++ b/plugins/views/documentation/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
@@ -25,15 +25,21 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.DiagramsUtil;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.views.documentation.DocumentationManager;
import org.eclipse.papyrus.views.documentation.IDocumentationManager;
import org.eclipse.papyrus.views.documentation.view.IDocumentationPartHandler;
import org.eclipse.papyrus.views.documentation.view.SelectResourceDialog;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
@@ -52,10 +58,14 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
}
public void executeCommand(IWorkbenchPart part, Command cmd) {
- CoreMultiDiagramEditor editor = getPapyrusEditor(part);
- if(editor != null && cmd != null) {
- TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
- domain.getCommandStack().execute(cmd);
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null && cmd != null) {
+ try {
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ domain.getCommandStack().execute(cmd);
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.err);
+ }
}
}
@@ -78,9 +88,9 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
public void openElement(IWorkbenchPart part, URI elementUri) {
try {
- CoreMultiDiagramEditor editor = getPapyrusEditor(part);
- if(editor != null) {
- EditingDomain ed = editor.getEditingDomain();
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null) {
+ EditingDomain ed = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
if(ed != null) {
EObject eObject = ed.getResourceSet().getEObject(elementUri, false);
Diagram diagram = null;
@@ -93,7 +103,7 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
}
}
if(diagram != null) {
- IPageMngr pageMngr = (IPageMngr)editor.getAdapter(IPageMngr.class);
+ IPageMngr pageMngr = ServiceUtils.getInstance().getIPageMngr(registry);
if(pageMngr != null) {
if(pageMngr.isOpen(diagram)) {
pageMngr.closePage(diagram);
@@ -109,8 +119,8 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
public EObject openElementSelectionDialog(IWorkbenchPart part) {
Object selectedElement = null;
- CoreMultiDiagramEditor editor = getPapyrusEditor(part);
- if(editor != null) {
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null) {
ISelectionStatusValidator validator = new ISelectionStatusValidator() {
public IStatus validate(Object[] selectedElements) {
@@ -129,16 +139,29 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
return enableOK ? new Status(IStatus.OK, "org.eclipse.emf.common.ui", 0, msg, null) : new Status(IStatus.ERROR, "org.eclipse.emf.common.ui", 0, msg, null);
}
};
- selectedElement = SelectResourceDialog.openElementSelection(editor.getServicesRegistry(), new MoDiscoLabelProvider(), new MoDiscoContentProvider(), validator, null, true);
+
+ ILabelProvider labelProvider;
+ try {
+ labelProvider = registry.getService(LabelProviderService.class).getLabelProvider();
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.out);
+ labelProvider = new LabelProvider();
+ }
+
+ selectedElement = SelectResourceDialog.openElementSelection(registry, labelProvider, new MoDiscoContentProvider(), validator, null, true);
}
return adapt(selectedElement);
}
public boolean isReadOnly(IWorkbenchPart part, EObject eObject) {
- CoreMultiDiagramEditor editor = getPapyrusEditor(part);
- if(editor != null && eObject != null) {
- TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
- return domain.isReadOnly(eObject.eResource());
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null && eObject != null) {
+ try {
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ return domain.isReadOnly(eObject.eResource());
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.out);
+ }
}
return false;
}
@@ -153,13 +176,13 @@ public class PapyrusDocumentationPartHandler implements IDocumentationPartHandle
return null;
}
- private static CoreMultiDiagramEditor getPapyrusEditor(IWorkbenchPart part) {
- if(part instanceof CoreMultiDiagramEditor) {
- return (CoreMultiDiagramEditor)part;
+ private static ServicesRegistry getServicesRegistry(IWorkbenchPart part) {
+ if(part instanceof IMultiDiagramEditor) {
+ return ((IMultiDiagramEditor)part).getServicesRegistry();
}
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if(activeEditor instanceof CoreMultiDiagramEditor) {
- return (CoreMultiDiagramEditor)activeEditor;
+ if(activeEditor instanceof IMultiDiagramEditor) {
+ return ((IMultiDiagramEditor)activeEditor).getServicesRegistry();
}
return null;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
index 4e7dd8d363d..e284979b6b6 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
@@ -34,8 +34,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
- org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.semantic;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.views.modelexplorer,
org.eclipse.papyrus.views.modelexplorer.actionprovider,
org.eclipse.papyrus.views.modelexplorer.actions,
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
index 8cef02611ae..f64bf2ecec6 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
@@ -21,7 +21,13 @@
</dragAssistant>
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent activeByDefault="false" contentProvider="org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider" id="org.eclipse.papyrus.views.modelexplorer.navigatorContent" labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider" name="Model Contents" priority="lowest">
+ <navigatorContent
+ activeByDefault="false"
+ contentProvider="org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider"
+ id="org.eclipse.papyrus.views.modelexplorer.navigatorContent"
+ labelProvider="org.eclipse.jface.viewers.LabelProvider"
+ name="Model Contents"
+ priority="lowest">
<triggerPoints>
<or>
<instanceof value="org.eclipse.emf.ecore.EObject">
@@ -231,7 +237,7 @@
</instanceof>
</selectionEnablement>
<editorInputEnablement>
- <instanceof value="org.eclipse.ui.part.IFileEditorInput">
+ <instanceof value="org.eclipse.ui.IFileEditorInput">
</instanceof>
</editorInputEnablement>
</linkHelper>
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java
index ad8489d64a9..020ad9522ce 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java
@@ -16,28 +16,71 @@
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.services.decoration.DecorationService;
+import org.eclipse.papyrus.infra.services.decoration.util.Decoration;
+import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
+import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.internal.navigator.NavigatorDecoratingLabelProvider;
/**
- * the label provider that inherits of modisco label provider
- *
+ * A LabelProvider with support for decorations
*/
public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelProvider {
- private MoDiscoLabelProvider moDiscoLP;
+ private DecorationService decorationService;
- public DecoratingLabelProviderWTooltips(ILabelProvider labelProvider) {
+ public DecoratingLabelProviderWTooltips(ILabelProvider labelProvider, ServicesRegistry servicesRegistry) {
super(labelProvider);
- if(labelProvider instanceof MoDiscoLabelProvider) {
- moDiscoLP = (MoDiscoLabelProvider)labelProvider;
+ try {
+ this.decorationService = servicesRegistry.getService(DecorationService.class);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
}
}
@Override
public String getToolTipText(Object element) {
- return moDiscoLP.getMarkerMessage(element);
+ if(decorationService == null) {
+ return null;
+ }
+
+ List<IPapyrusDecoration> decorations = decorationService.getDecorations(element, true);
+ return Decoration.getMessageFromDecorations(decorations);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ Image baseImage = super.getImage(element);
+
+ if(decorationService == null) {
+ return baseImage;
+ }
+ // Get the Model Explorer Adapter
+ ModelExplorerDecorationAdapter adapter = new ModelExplorerDecorationAdapter(baseImage);
+
+
+ //Set the adapter decoration with position as indicated by decoration (from decoration service)
+ if(element != null) {
+ if(element instanceof EObject || (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(EObject.class) != null)) {
+ List<IPapyrusDecoration> decorations = decorationService.getDecorations(element, true);
+ if(decorations != null) {
+ adapter.setDecorations(decorations);
+ }
+ }
+ }
+
+ //return the target decorated
+ return adapter.getDecoratedImage();
+
}
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
index e72d1ace22b..9f696c74c82 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
@@ -21,10 +21,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForWorkbenchPage;
import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -65,11 +63,8 @@ public class LinkHelper implements ILinkHelper {
//test if the selection come the tree viewer in order to avoid cycle: Diagram -> tree-> diagram
// if the diagram has been selected the selection is not a TreeSelection
if(selection instanceof ITreeSelection) {
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
-
-
try {
- ISashWindowsContainer windowsContainer = ServiceUtils.getInstance().getISashWindowsContainer(papyrusEditor.getServicesRegistry());
+ ISashWindowsContainer windowsContainer = ServiceUtilsForWorkbenchPage.getInstance().getISashWindowsContainer(aPage);
Iterator<IEditorPart> iterPart = windowsContainer.getVisibleIEditorParts().iterator();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProvider.java
deleted file mode 100644
index d0466f36b50..00000000000
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProvider.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*****************************************************************************
- * 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
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- * Amine EL KOUHEN (CEA LIST/LIFL) - Added the decorator Factory
- *****************************************************************************/
-package org.eclipse.papyrus.views.modelexplorer;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.services.decoration.DecorationService;
-import org.eclipse.papyrus.infra.services.decoration.util.Decoration;
-import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
-import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * the label provider that inherits of modisco label provider.
- */
-public class MoDiscoLabelProvider extends CustomizableModelLabelProvider {
-
- /** icon registry. */
- private IPageIconsRegistry editorRegistry;
-
- /** Decoration Service *. */
- private DecorationService decorationService;
-
- /**
- * Creates a new MoDiscoLabelProvider.
- */
- public MoDiscoLabelProvider() {
- super(Activator.getDefault().getCustomizationManager());
- try {
- decorationService = EditorUtils.getServiceRegistry().getService(DecorationService.class);
- /* OR : decorationService = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry().getService(DecorationService.class); */
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
-
- /**
- * Returns the message of the marker for the specified element.
- *
- * @param element
- * the element for which the marker message should be found
- * @return the message of the marker for the specified element
- */
- public String getMarkerMessage(Object element) {
- EList<IPapyrusDecoration> decorations = decorationService.getDecorations(element, true);
- return Decoration.getMessageFromDecorations(decorations);
- }
-
- /**
- * return the image of an element in the model browser
- * evaluates error markers.
- *
- * @param element
- * the element
- * @return the image
- */
- @Override
- public Image getImage(Object element) {
-
- // Get the Model Explorer Adapter
- ModelExplorerDecorationAdapter adapter = new ModelExplorerDecorationAdapter(null);
-
-
- //Set the decoration target
- /**
- * Useless since EMF Facet integration with bug 358732
- */
- if(element instanceof Diagram) {
- adapter.setDecoratorTarget(getEditorRegistry().getEditorIcon(element));
- } else {
- adapter.setDecoratorTarget(super.getImage(element));
- }
-
- //Set the adapter decoration with position as indicated by decoration (from decoration service)
- if(element != null) {
- if(element instanceof EObject || (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(EObject.class) != null)) {
- EList<IPapyrusDecoration> decorations = decorationService.getDecorations(element, true);
- if(decorations != null) {
- adapter.setDecorations(decorations);
- }
- }
- }
-
- //return the target decorated
- return adapter.getDecoratedImage();
-
- }
-
- /**
- * Get the EditorRegistry used to create editor instances. This default
- * implementation return the singleton eINSTANCE. This method can be
- * subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each
- // request.
- return new PageIconsRegistry();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- String text = null;
- if(element instanceof Diagram) {
- Diagram diagram = (Diagram)element;
- text = diagram.getName();
- } else if(element instanceof IAdaptable) {
- EObject obj = (EObject)((IAdaptable)element).getAdapter(EObject.class);
- if(obj instanceof InternalEObject && obj.eIsProxy()) {
- InternalEObject internal = (InternalEObject)obj;
- text = NLS.bind(Messages.MoDiscoLabelProvider_ProxyLabel, obj.getClass().getSimpleName(), internal.eProxyURI().trimFragment());
- // Messages.MoDiscoLabelProvider_0 + + Messages.MoDiscoLabelProvider_1 + ;;
- } else {
- text = super.getText(element);
- }
- } else {
- text = super.getText(element);
- }
- return text;
- }
-}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index 8681d76ab8a..c49f48a472b 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -22,7 +22,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -40,6 +39,7 @@ 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.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.ToolTip;
@@ -51,9 +51,9 @@ import org.eclipse.papyrus.infra.core.resource.additional.AdditionalResourcesMod
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.providers.SemanticFromModelExplorer;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
import org.eclipse.papyrus.views.modelexplorer.listener.DoubleClickListener;
import org.eclipse.papyrus.views.modelexplorer.matching.IMatchingItem;
@@ -97,6 +97,13 @@ import com.google.common.collect.Lists;
public class ModelExplorerView extends CommonNavigator implements IRevealSemanticElement, IEditingDomainProvider {
/**
+ * The context of the LabelProviderService used by this view
+ *
+ * @see {@link LabelProviderService}
+ */
+ public static final String LABEL_PROVIDER_SERVICE_CONTEXT = "org.eclipse.papyrus.views.modelexplorer.labelProvider.context";
+
+ /**
* The associated EditorPart
* The View is associated to the ServicesRegistry rather than to an editor.
* */
@@ -323,15 +330,29 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
@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);
+ Object input = getInitialInput();
+ Set<Object> descriptors = contentService.findDescriptorsByTriggerPoint(input, false);
for(Object descriptor : descriptors) {
if(descriptor instanceof NavigatorContentDescriptor) {
- try {
- ILabelProvider labelProvider = ((NavigatorContentDescriptor)descriptor).createLabelProvider();
- viewer.setLabelProvider(new DecoratingLabelProviderWTooltips(labelProvider)); // add for decorator and tooltip support
- } catch (CoreException e) {
- Activator.log.error(e);
+ ILabelProvider labelProvider = null;
+
+ if(input instanceof ServicesRegistry) {
+ ServicesRegistry registry = (ServicesRegistry)input;
+ try {
+ labelProvider = registry.getService(LabelProviderService.class).getLabelProvider(LABEL_PROVIDER_SERVICE_CONTEXT);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ labelProvider = new DecoratingLabelProviderWTooltips(labelProvider, (ServicesRegistry)input);
+ }
+
+ if(labelProvider == null) {
+ labelProvider = new LabelProvider();
}
+
+ //ILabelProvider labelProvider = ((NavigatorContentDescriptor)descriptor).createLabelProvider();
+ viewer.setLabelProvider(labelProvider); // add for decorator and tooltip support
break;
}
}
@@ -584,16 +605,20 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
* @return
*/
private IPropertySheetPage getPropertySheetPage() {
- final IMultiDiagramEditor multiDiagramEditor = EditorUtils.getMultiDiagramEditor();
+ try {
+ final IMultiDiagramEditor multiDiagramEditor = ServiceUtils.getInstance().getService(IMultiDiagramEditor.class, serviceRegistry);
- if(multiDiagramEditor != null) {
- if(propertySheetPage == null) {
- if(multiDiagramEditor instanceof ITabbedPropertySheetPageContributor) {
- ITabbedPropertySheetPageContributor contributor = (ITabbedPropertySheetPageContributor)multiDiagramEditor;
- this.propertySheetPage = new TabbedPropertySheetPage(contributor);
+ if(multiDiagramEditor != null) {
+ if(propertySheetPage == null) {
+ if(multiDiagramEditor instanceof ITabbedPropertySheetPageContributor) {
+ ITabbedPropertySheetPageContributor contributor = (ITabbedPropertySheetPageContributor)multiDiagramEditor;
+ this.propertySheetPage = new TabbedPropertySheetPage(contributor);
+ }
}
+ return propertySheetPage;
}
- return propertySheetPage;
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
}
return null;
}
@@ -649,8 +674,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
/**
* Expands the given CommonViewer to reveal the given elements
- * @param elementList The elements to reveal
- * @param commonViewer The CommonViewer they are to be revealed in
+ *
+ * @param elementList
+ * The elements to reveal
+ * @param commonViewer
+ * The CommonViewer they are to be revealed in
*/
public static void reveal(Iterable<?> elementList, CommonViewer commonViewer) {
ArrayList<IMatchingItem> matchingItemsToSelect = new ArrayList<IMatchingItem>();
@@ -680,15 +708,15 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
// reveal the resource if necessary
Resource r = null;
- if (!parents.isEmpty()) {
- r = parents.get(parents.size() - 1).eResource();
+ if(!parents.isEmpty()) {
+ r = parents.get(parents.size() - 1).eResource();
} else {
r = currentEObject.eResource();
}
- if (r != null) {
+ if(r != null) {
ResourceSet rs = r.getResourceSet();
- if (rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet)rs, r.getURI())) {
+ if(rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet)rs, r.getURI())) {
commonViewer.expandToLevel(new ReferencableMatchingItem(rs), 1);
commonViewer.expandToLevel(new ReferencableMatchingItem(r), 1);
}
@@ -720,11 +748,14 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
selectReveal(new StructuredSelection(matchingItemsToSelect), commonViewer);
}
-
+
/**
* Selects the given ISelection in the given CommonViwer
- * @param structuredSelection The ISelection to select
- * @param commonViewer The ComonViewer to select it in
+ *
+ * @param structuredSelection
+ * The ISelection to select
+ * @param commonViewer
+ * The ComonViewer to select it in
*/
public static void selectReveal(ISelection structuredSelection, Viewer commonViewer) {
commonViewer.setSelection(structuredSelection, true);
@@ -732,8 +763,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
/**
* Selects and, if possible, reveals the given ISelection in the given CommonViwer
- * @param selection The ISelection to select
- * @param viewer The ComonViewer to select it in
+ *
+ * @param selection
+ * The ISelection to select
+ * @param viewer
+ * The ComonViewer to select it in
*/
public static void reveal(ISelection selection, CommonViewer viewer) {
if(selection instanceof IStructuredSelection) {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
index a955d2b702e..4fb2228d7ab 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
@@ -12,7 +12,8 @@
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview;
-import org.eclipse.emf.common.util.EList;
+import java.util.List;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
@@ -31,7 +32,7 @@ public class ModelExplorerDecorationAdapter {
protected Image decoratorTarget;
/** The decoration. */
- protected EList<IPapyrusDecoration> decorations;
+ protected List<IPapyrusDecoration> decorations;
/** The decoration position. */
protected int decorationPosition;
@@ -67,7 +68,7 @@ public class ModelExplorerDecorationAdapter {
* @param decorationPosition
* the decoration position
*/
- public void setDecorations(EList<IPapyrusDecoration> decorations) {
+ public void setDecorations(List<IPapyrusDecoration> decorations) {
this.decorations = decorations;
}
@@ -103,6 +104,9 @@ public class ModelExplorerDecorationAdapter {
* the decoration position
*/
public Image getDecoratedImage() {
+ if(decoratorTarget == null) {
+ return null;
+ }
if(decorations == null) {
return decoratorTarget;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
index 27aec4e2df8..3852be90c15 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.views.modelexplorer.handler;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -43,8 +44,8 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.uml.tools.model.UmlUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.services.semantic.service.SemanticService;
import org.eclipse.papyrus.views.modelexplorer.Activator;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Shell;
@@ -84,7 +85,16 @@ public class LoadBrowserCustomization extends AbstractHandler {
CustomizationManager customizationManager = Activator.getDefault().getCustomizationManager();
final List<MetamodelView> registeredCustomizations = customizationManager.getRegisteredCustomizations();
- final LoadCustomizationsDialog loadCustomizationsDialog = new LoadCustomizationsDialog(new Shell(), registeredCustomizations, getMetamodels());
+ LoadCustomizationsDialog loadCustomizationsDialog;
+
+ try {
+ ServicesRegistry registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ loadCustomizationsDialog = new LoadCustomizationsDialog(new Shell(), registeredCustomizations, getMetamodels(registry));
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ loadCustomizationsDialog = new LoadCustomizationsDialog(new Shell(), registeredCustomizations, Collections.<EPackage> emptyList());
+ }
+
if(Window.OK == loadCustomizationsDialog.open()) {
try {
@@ -220,37 +230,32 @@ public class LoadBrowserCustomization extends AbstractHandler {
return builder.toString();
}
- /**
- * Get the metmodel URI
- * **/
- public String getMetamodelURI() {
-
- try {
- EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
- if(contents.size() > 0) {
- EObject eObject = contents.get(0);
- EClass eClass = eObject.eClass();
- if(eClass != null) {
- return eClass.getEPackage().getNsURI();
- }
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
- return ""; //$NON-NLS-1$
- }
+ // /**
+ // * Get the metmodel URI
+ // * **/
+ //@Unused
+ // private String getMetamodelURI() {
+ //
+ // try {
+ // EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
+ // if(contents.size() > 0) {
+ // EObject eObject = contents.get(0);
+ // EClass eClass = eObject.eClass();
+ // if(eClass != null) {
+ // return eClass.getEPackage().getNsURI();
+ // }
+ // }
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ // return ""; //$NON-NLS-1$
+ // }
/**
* Get the metmodel URI
* **/
- public List<EPackage> getMetamodels() {
+ protected List<EPackage> getMetamodels(ServicesRegistry serviceRegistry) {
List<EPackage> ePackages = new ArrayList<EPackage>();
- ServicesRegistry serviceRegistry = null;
- try {
- serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
/*
* we look for the current editors, because their are represented in the model explorer
@@ -259,30 +264,32 @@ public class LoadBrowserCustomization extends AbstractHandler {
IPageMngr pageMngr = null;
try {
pageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
- List<Object> pages = pageMngr.allPages();
- for(int i = 0; i < pages.size(); i++) {
- if(pages.get(i) instanceof EObject) {
- EPackage ePackage = ((EObject)pages.get(i)).eClass().getEPackage();
- if(!ePackages.contains(ePackage)) {
- ePackages.add(ePackage);
+ List<Object> pages = pageMngr.allPages();
+ for(int i = 0; i < pages.size(); i++) {
+ if(pages.get(i) instanceof EObject) {
+ EPackage ePackage = ((EObject)pages.get(i)).eClass().getEPackage();
+ if(!ePackages.contains(ePackage)) {
+ ePackages.add(ePackage);
+ }
}
}
+ } catch (ServiceException e) {
+ Activator.log.error(e);
}
try {
- EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
- if(contents.size() > 0) {
- EObject eObject = contents.get(0);
- EClass eClass = eObject.eClass();
+ SemanticService semantic = serviceRegistry.getService(SemanticService.class);
+ for(EObject rootElement : semantic.getSemanticRoots()) {
+ EClass eClass = rootElement.eClass();
if(eClass != null) {
- ePackages.add(eClass.getEPackage());
+ EPackage ePackage = eClass.getEPackage();
+ if(!ePackages.contains(ePackage)) {
+ ePackages.add(eClass.getEPackage());
+ }
}
}
- } catch (Exception e) {
- Activator.log.error(e);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
}
return ePackages;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java
index e60271bcead..d835c942cdc 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java
@@ -14,32 +14,28 @@
package org.eclipse.papyrus.views.modelexplorer.queries;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
/**
*
* An abstract class to get the pageMngr
- *
+ *
*/
public abstract class AbstractEditorContainerQuery {//we don't need to implements IJavaModelQuery here
- /**
- *
- * @return
- * @throws ServiceException
- */
- protected IPageMngr getPageMngr() throws ServiceException {
- // pageMngr can't be static, because there is a new IPageMngr each time we open a Papyrus Editor
- IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
- if (papyrusEditor != null) {
- ServicesRegistry serviceRegistry = papyrusEditor.getServicesRegistry();
- return ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
- }
- throw new ServiceException("Can't retrieve the IPageMngr");
- }
+ // /**
+ // *
+ // * @return
+ // * @throws ServiceException
+ // */
+ // @Deprecated
+ // //@unused
+ // protected IPageMngr getPageMngr() throws ServiceException {
+ // // pageMngr can't be static, because there is a new IPageMngr each time we open a Papyrus Editor
+ // IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ // if (papyrusEditor != null) {
+ // ServicesRegistry serviceRegistry = papyrusEditor.getServicesRegistry();
+ // return ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
+ // }
+ // throw new ServiceException("Can't retrieve the IPageMngr");
+ // }
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java
index a2eced89f0b..a828c2feafa 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java
@@ -14,18 +14,19 @@
package org.eclipse.papyrus.views.modelexplorer.queries;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
/**
*
* An abstract class to get the iconRegistery
- *
+ *
*/
-public abstract class AbstractGetEditorIconQuery{//we don't need to implements IJavaModelQuery here
+public abstract class AbstractGetEditorIconQuery {//we don't need to implements IJavaModelQuery here
/**
* the icon registry
@@ -39,9 +40,9 @@ public abstract class AbstractGetEditorIconQuery{//we don't need to implements I
*
* @return the singleton eINSTANCE of editor registry
*/
- protected IPageIconsRegistryExtended getEditorRegistry() {
+ protected IPageIconsRegistryExtended getEditorRegistry(EObject context) {
if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
+ editorRegistry = createEditorRegistry(context);
}
if(!(editorRegistry instanceof IPageIconsRegistryExtended)) {
throw new RuntimeException("The editor registry do not implement IPageIconsRegistryExtended");////$NON-NLS-1$
@@ -55,11 +56,10 @@ public abstract class AbstractGetEditorIconQuery{//we don't need to implements I
* extension point namespace.
*
* @return the EditorRegistry for nested editor descriptors
- * FIXME : use a deprecated method
*/
- protected IPageIconsRegistry createEditorRegistry() {
+ protected IPageIconsRegistry createEditorRegistry(EObject context) {
try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
+ return ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, context);
} catch (ServiceException e) {
// Not found, return an empty one which return null for each
// request.
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/labelprovider.exsd b/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/labelprovider.exsd
index 4230f16eacf..453c5c8a592 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/labelprovider.exsd
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/labelprovider.exsd
@@ -55,7 +55,7 @@
</documentation>
<appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider"/>
</appInfo>
</annotation>
</attribute>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
index 8b225b9345b..3aa0e1310f8 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
@@ -24,11 +24,11 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableList;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableValue;
import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
@@ -202,7 +202,7 @@ public class EMFModelElement extends AbstractModelElement {
return ServiceUtilsForResource.getInstance().getServiceRegistry(source.eResource()).getService(LabelProviderService.class).getLabelProvider();
} catch (ServiceException ex) {
Activator.log.error(ex);
- return new LabelProvider();
+ return new EMFLabelProvider();
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/providers/SelectionLabelProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/providers/SelectionLabelProvider.java
index 7c18f34fd71..2a654964e85 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/providers/SelectionLabelProvider.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/providers/SelectionLabelProvider.java
@@ -16,8 +16,8 @@ import java.util.TreeMap;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.widgets.providers.ExtensibleLabelProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.ExtensibleLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.papyrus.views.properties.Activator;
/**
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/xwt/XWTTabDescriptorProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/xwt/XWTTabDescriptorProvider.java
index ed81e81996d..20ba2b1ec49 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/xwt/XWTTabDescriptorProvider.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/xwt/XWTTabDescriptorProvider.java
@@ -103,37 +103,47 @@ public class XWTTabDescriptorProvider implements ITabDescriptorProvider {
descriptors.addAll(getDisplay(part).getTabDescriptors(views));
}
+ //FIXME: In some cases (e.g. Selection in the Papyrus Tree outline), the IWorkbenchPart is not an ITabbedPropertySheetPageContributor
+ //TODO: Investigate on this case and fix the issue (contributor == null in this case)
+ ITabbedPropertySheetPageContributor contributor;
+ if(part instanceof ITabbedPropertySheetPageContributor) {
+ contributor = (ITabbedPropertySheetPageContributor)part;
+ } else {
+ contributor = (ITabbedPropertySheetPageContributor)(part.getAdapter(ITabbedPropertySheetPageContributor.class));
+ }
- // get all tab descriptors for the registered extension points
- TabbedPropertyRegistry registry = TabbedPropertyRegistryFactory.getInstance().createRegistry((ITabbedPropertySheetPageContributor)part);
-
- // invoke dynamically on the tab registry, as method is private
- // problem of implementation of tabbed properties tabbed registry. Either contribution using extension points, either a tabprovider
- // both contribution can not exist together, the only solution is to make a workaround.
- try {
- Method method = TabbedPropertyRegistry.class.getDeclaredMethod("getAllTabDescriptors"); //$NON-NLS-1$
- method.setAccessible(true);
- ITabDescriptor[] registeredTabDesriptors;
-
- registeredTabDesriptors = (ITabDescriptor[])method.invoke(registry);
-
- if(registeredTabDesriptors != null) {
- for(ITabDescriptor descriptor : registeredTabDesriptors) {
- if(descriptor.getSectionDescriptors().size() > 0) {
- descriptors.add(descriptor);
+ if(contributor != null) {
+ // get all tab descriptors for the registered extension points
+ TabbedPropertyRegistry registry = TabbedPropertyRegistryFactory.getInstance().createRegistry(contributor);
+
+ // invoke dynamically on the tab registry, as method is private
+ // problem of implementation of tabbed properties tabbed registry. Either contribution using extension points, either a tabprovider
+ // both contribution can not exist together, the only solution is to make a workaround.
+ try {
+ Method method = TabbedPropertyRegistry.class.getDeclaredMethod("getAllTabDescriptors"); //$NON-NLS-1$
+ method.setAccessible(true);
+ ITabDescriptor[] registeredTabDesriptors;
+
+ registeredTabDesriptors = (ITabDescriptor[])method.invoke(registry);
+
+ if(registeredTabDesriptors != null) {
+ for(ITabDescriptor descriptor : registeredTabDesriptors) {
+ if(descriptor.getSectionDescriptors().size() > 0) {
+ descriptors.add(descriptor);
+ }
}
}
+ } catch (IllegalArgumentException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ } catch (InvocationTargetException e) {
+ Activator.log.error(e);
+ } catch (SecurityException e) {
+ Activator.log.error(e);
+ } catch (NoSuchMethodException e) {
+ Activator.log.error(e);
}
- } catch (IllegalArgumentException e) {
- Activator.log.error(e);
- } catch (IllegalAccessException e) {
- Activator.log.error(e);
- } catch (InvocationTargetException e) {
- Activator.log.error(e);
- } catch (SecurityException e) {
- Activator.log.error(e);
- } catch (NoSuchMethodException e) {
- Activator.log.error(e);
}
orderTabDescriptors(descriptors);
diff --git a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/Activator.java b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/Activator.java
index ecb41c215d5..c768102bf62 100644
--- a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/Activator.java
+++ b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/Activator.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.gmfdiag.css.palette;
import org.eclipse.papyrus.infra.core.log.LogHelper;
diff --git a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/aspect/CSSStylePostAction.java b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/aspect/CSSStylePostAction.java
index 2fea895636c..705314caefb 100644
--- a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/aspect/CSSStylePostAction.java
+++ b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/aspect/CSSStylePostAction.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.gmfdiag.css.palette.aspect;
import java.util.Collections;
@@ -36,7 +47,11 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-
+/**
+ * A Palette post action to automatically add a CSS Style on a newly created element
+ *
+ * @author Camille Letavernier
+ */
public class CSSStylePostAction extends ModelPostAction {
private StringCombo editor;
@@ -53,7 +68,7 @@ public class CSSStylePostAction extends ModelPostAction {
public Control createConfigurationComposite(Composite parent, IPaletteEntryProxy entryProxy, List<Profile> appliedProfiles) {
editor = new StringCombo(parent, SWT.NONE);
- editor.setContentProvider(EmptyContentProvider.instance); //We should not depend on the CSS Parser ; do not use CSSClassContentProvider
+ editor.setContentProvider(EmptyContentProvider.instance); //TODO: We should not depend on the CSS Parser ; do not use CSSClassContentProvider.
return editor;
}
@@ -85,7 +100,7 @@ public class CSSStylePostAction extends ModelPostAction {
}
//We should not depend on the properties view to edit the custom style.
- //FIXME: Move CustomStyleValueCommand to infra.gmfdiag.common (or infra.gmfdiag.tools)
+ //FIXME: Move CustomStyleValueCommand to infra.gmfdiag.common (or infra.gmfdiag.tools)
@Override
public void run(final EditPart editPart) {
TransactionalEditingDomain domain = (TransactionalEditingDomain)EMFHelper.resolveEditingDomain(editPart);
diff --git a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/provider/CSSStyleAspectActionProvider.java b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/provider/CSSStyleAspectActionProvider.java
index 67626f1894f..bc5529c9ba8 100644
--- a/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/provider/CSSStyleAspectActionProvider.java
+++ b/sandbox/org.eclipse.papyrus.infra.gmfdiag.css.palette/src/org/eclipse/papyrus/infra/gmfdiag/css/palette/provider/CSSStyleAspectActionProvider.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.infra.gmfdiag.css.palette.provider;
import org.eclipse.papyrus.infra.gmfdiag.css.palette.aspect.CSSStylePostAction;
@@ -6,7 +17,13 @@ import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction;
import org.eclipse.papyrus.uml.diagram.common.service.palette.IPaletteEntryProxy;
import org.w3c.dom.Node;
-
+/**
+ * A Palette post action provider to automatically add a CSS Style on a newly created element
+ *
+ * @author Camille Letavernier
+ *
+ * @see CSSStylePostAction
+ */
public class CSSStyleAspectActionProvider extends AbstractAspectActionProvider {
public IAspectAction createAction(Node configurationNode) {
diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/src/org/eclipse/papyrus/infra/services/labelprovider/tests/providers/EMFLabelProviderTest.java b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/src/org/eclipse/papyrus/infra/services/labelprovider/tests/providers/EMFLabelProviderTest.java
index 8f2b8812f26..979af058c9d 100644
--- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/src/org/eclipse/papyrus/infra/services/labelprovider/tests/providers/EMFLabelProviderTest.java
+++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/src/org/eclipse/papyrus/infra/services/labelprovider/tests/providers/EMFLabelProviderTest.java
@@ -12,8 +12,8 @@
package org.eclipse.papyrus.infra.services.labelprovider.tests.providers;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.papyrus.infra.services.labelprovider.tests.LabelProviderServiceTest;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch
index 24667c39d9b..35101e99b69 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch
@@ -15,20 +15,20 @@
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.papyrus.uml.diagram.sequence.tests"/>
+<listEntry value="/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/AllTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
+<listEntry value="1"/>
</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.papyrus.uml.diagram.sequence.tests"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.diagram.sequence.tests.AllTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.diagram.sequence.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx600m -XX:PermSize=128m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms256m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java
index efddb5cb893..35fdb4f9dd5 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestLink.java
@@ -190,7 +190,7 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java
index 535c233b526..d99e47e800f 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestTopNode.java
@@ -195,7 +195,7 @@ public abstract class TestTopNode extends AbstractPapyrusTestCase {
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java
index 8aabd2b7ac8..bc3a4e8ec5f 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase.tests/src/org/eclipse/papyrus/uml/diagram/usecase/tests/canonical/TestSpecificTopNode.java
@@ -42,6 +42,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.uml2.uml.Element;
+
/**
* The Class TestTopNode.
*/
@@ -51,36 +52,38 @@ public abstract class TestSpecificTopNode extends org.eclipse.papyrus.diagram.te
/**
* Test view deletion.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testViewDeletion(IElementType type) {
//DELETION OF THE VIEW
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==1);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((GraphicalEditPart)getDiagramEditPart().getChildren().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,getDiagramEditPart().getChildren().size()==1);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(VIEW_DELETION +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 1);
}
+
/**
* Retrieves the TransactionalEditingDomain
*
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
@@ -91,194 +94,200 @@ public abstract class TestSpecificTopNode extends org.eclipse.papyrus.diagram.te
return editingDomain;
}
+
/**
* Test destroy.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testDestroy(IElementType type) {
//DESTROY SEMANTIC+ VIEW
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
- Request deleteViewRequest = new EditCommandRequestWrapper( new DestroyElementRequest(false));
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((GraphicalEditPart)getDiagramEditPart().getChildren().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION +COMMAND_NULL,command);
- assertTrue(DESTROY_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 0);
+
-
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,getDiagramEditPart().getChildren().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 0);
}
/**
* Test drop.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testDrop(IElementType type) {
//DROP
- assertTrue(DROP +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(DROP +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(getRootSemanticModel().getOwnedElements().get(0));
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= getDiagramEditPart().getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = getDiagramEditPart().getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()!=0);
- assertTrue(DROP +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() != 0);
+ assertTrue(DROP + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() != 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DROP+TEST_THE_UNDO,getDiagramEditPart().getChildren().size()==0);
- assertTrue(DROP+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(DROP + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() != 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DROP+TEST_THE_REDO,getDiagramEditPart().getChildren().size()!=0);
- assertTrue(DROP+TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() != 0);
+ assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() != 0);
}
/**
* Test change container.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
public void testChangeContainer(IElementType type, IElementType containerType) {
//CHANGE CONTAINER
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
- Request requestcreation=CreateViewRequestFactory.getCreateShapeRequest(containerType, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CONTAINER_CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CONTAINER_CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==2);
- GraphicalEditPart containerEditPart= (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ assertTrue(CONTAINER_CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 2);
+ GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
ChangeBoundsRequest changeBoundsRequest = new ChangeBoundsRequest(RequestConstants.REQ_ADD);
changeBoundsRequest.setEditParts((EditPart)getDiagramEditPart().getChildren().get(0));
- changeBoundsRequest.setLocation(new Point(30,30));
- ShapeCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <containerEditPart.getChildren().size()){
- if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart){
- compartment= (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
+ changeBoundsRequest.setLocation(new Point(30, 30));
+ ShapeCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < containerEditPart.getChildren().size()) {
+ if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
+ compartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
- command=compartment.getCommand(changeBoundsRequest);
- assertNotNull(CHANGE_CONTAINER,command);
- assertTrue(CHANGE_CONTAINER+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(CHANGE_CONTAINER+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ command = compartment.getCommand(changeBoundsRequest);
+ assertNotNull(CHANGE_CONTAINER, command);
+ assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,getRootView().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,getRootView().getChildren().size()==2);
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==2);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootView().getChildren().size() == 2);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 2);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,getRootView().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootView().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
}
/**
* Test to create a node.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testToCreateANode(IElementType type) {
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
- ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(
- new CreateElementRequestAdapter(new CreateElementRequest(type)),
- Node.class, ((IHintedType) type).getSemanticHint(), getDiagramEditPart().getDiagramPreferencesHint());
- CreateViewRequest requestcreation= new CreateViewAndElementRequest(viewDescriptor);
-
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(new CreateElementRequest(type)), Node.class, ((IHintedType)type).getSemanticHint(), getDiagramEditPart().getDiagramPreferencesHint());
+ CreateViewRequest requestcreation = new CreateViewAndElementRequest(viewDescriptor);
+
//CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION+TEST_THE_UNDO,getRootView().getChildren().size()==0);
- assertTrue(CREATION+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==0);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 0);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
-
- assertTrue("CREATION: "+TEST_THE_REDO,getDiagramEditPart().getChildren().size()==1);
+
+ assertTrue("CREATION: " + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 1);
}
/**
* Test to create a node.
*
- * @param type the type
+ * @param type
+ * the type
*/
- public void testToCreateSpecificNode(IElementType type, IHintedType semanticType) {
+ public void testToCreateSpecificNode(IElementType type, IHintedType semanticType) {
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
- CreateElementRequest semanticRequest=new CreateElementRequest(type);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ CreateElementRequest semanticRequest = new CreateElementRequest(type);
semanticRequest.setParameter("Subject_SemanticHint", semanticType);
-
- ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(
- new CreateElementRequestAdapter(semanticRequest),
- Node.class, ((IHintedType) type).getSemanticHint(), getDiagramEditPart().getDiagramPreferencesHint());
- CreateViewRequest requestcreation= new CreateViewAndElementRequest(viewDescriptor);
-
+
+ ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(semanticRequest), Node.class, ((IHintedType)type).getSemanticHint(), getDiagramEditPart().getDiagramPreferencesHint());
+ CreateViewRequest requestcreation = new CreateViewAndElementRequest(viewDescriptor);
+
//CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION+TEST_THE_UNDO,getRootView().getChildren().size()==0);
- assertTrue(CREATION+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==0);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 0);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
-
- assertTrue("CREATION: "+TEST_THE_REDO,getDiagramEditPart().getChildren().size()==1);
+
+ assertTrue("CREATION: " + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 1);
}
+
/**
* Test to manage top node.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
public void testToManageTopNode(IElementType type, IElementType containerType) {
- int i=0;
+ int i = 0;
testToCreateANode(type);
testDestroy(type);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
@@ -290,11 +299,13 @@ public abstract class TestSpecificTopNode extends org.eclipse.papyrus.diagram.te
/**
* Test to manage top node.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
public void testToManageSpecificTopNode(IElementType type, IElementType containerType, IHintedType semanticType) {
- int i=0;
+ int i = 0;
testToCreateSpecificNode(type, semanticType);
testDestroy(type);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestProfileApplication.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestProfileApplication.java
index 1cd4991c5e9..2e807e5dc7c 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestProfileApplication.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestProfileApplication.java
@@ -18,7 +18,8 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.uml2.uml.Model;
@@ -29,7 +30,7 @@ import org.junit.Test;
public class TestProfileApplication extends AbstractPapyrusTestCase {
@Test
- public void testToManageModel() {
+ public void testToManageModel() throws ServiceException {
RegisteredProfile registeredProfile = RegisteredProfile.getRegisteredProfile("TestProfile");
final Model root = ((Model)getDiagramEditPart().resolveSemanticElement());
assertTrue("Registered profile not found", registeredProfile != null);
@@ -39,7 +40,7 @@ public class TestProfileApplication extends AbstractPapyrusTestCase {
assertTrue("strange profile", ("".equals(registeredProfile.qualifiednames)));
final Profile profile = (Profile)modelResource.getContents().get(0);
// PackageUtil.applyProfile(root,profile, false);
- final TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(papyrusEditor.getServicesRegistry());
AppliedProfileCommand appliedProfileCommand = new AppliedProfileCommand(domain, root, profile);
domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(appliedProfileCommand));
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestStereotypeApplication.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestStereotypeApplication.java
index 37ec9cc420e..7894f011e38 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestStereotypeApplication.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.stereotypeproperty.tests/src/org/eclipse/papyrus/diagram/stereotypeproperty/TestStereotypeApplication.java
@@ -27,7 +27,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeConpartmentEditPart;
@@ -120,7 +120,7 @@ public class TestStereotypeApplication extends AbstractPapyrusTestCase {
final Resource modelResource = Util.getResourceSet(root).getResource(modelUri, true);
final Profile profile = (Profile)modelResource.getContents().get(0);
// PackageUtil.applyProfile(root,profile, false);
- final TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(papyrusEditor.getServicesRegistry());
AppliedProfileCommand appliedProfileCommand = new AppliedProfileCommand(domain, root, profile);
domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(appliedProfileCommand));
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
index 73e042e16fe..df4b1b70b72 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
@@ -55,49 +55,60 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
protected static final String THE_LINK_RECONNECT_EXISTS = "The Link exist";
+
protected static final String RECONNECTION_TARGET = "Reconnection of target";
+
protected static final String LINK_EXISTS_RECONNECTION_ON_TARGET = "Link exist on the target";
+
protected static final String THE_LINK_TO_RECONNECT_EXISTS = "The Link exist";
+
protected static final String RECONNECTION_SOURCE = "Reconnection of source";
+
protected static final String LINK_EXISTS_RECONNECTION_ON_SOURCE = "Link exist on the source";
- protected GraphicalEditPart source=null;
- protected GraphicalEditPart sourcePlayer=null;
- protected GraphicalEditPart target=null;
- protected GraphicalEditPart targetPlayer=null;
+
+ protected GraphicalEditPart source = null;
+
+ protected GraphicalEditPart sourcePlayer = null;
+
+ protected GraphicalEditPart target = null;
+
+ protected GraphicalEditPart targetPlayer = null;
/**
* Test view deletion.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testViewDeletion(IElementType type) {
//DELETION OF THE VIEW
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, source.getSourceConnections().size()==1);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,source.getSourceConnections().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 5);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,source.getSourceConnections().size()==1);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 5);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(VIEW_DELETION +TEST_THE_REDO,source.getSourceConnections().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 5);
}
+
/**
* Retrieves the TransactionalEditingDomain
*
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
@@ -108,214 +119,219 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
return editingDomain;
}
+
/**
* Test destroy.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testDestroy(IElementType type) {
//DESTROY SEMANTIC+ VIEW
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,source.getSourceConnections().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
- Request deleteViewRequest = new EditCommandRequestWrapper( new DestroyElementRequest(false));
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION +COMMAND_NULL,command);
- assertTrue(DESTROY_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,source.getSourceConnections().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,diagramEditor.getDiagramEditDomain().getDiagramCommandStack().canUndo()==true);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, diagramEditor.getDiagramEditDomain().getDiagramCommandStack().canUndo() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,source.getSourceConnections().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==5);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 5);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,source.getSourceConnections().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
}
/**
* Test drop.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testDrop(IElementType type) {
//DROP
- assertTrue(DROP +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==5);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(getRootSemanticModel().getOwnedElements().get(4));
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= getDiagramEditPart().getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = getDiagramEditPart().getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==5);
- assertTrue(DROP +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
+ assertTrue(DROP + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 5);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DROP +TEST_THE_UNDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==5);
- assertTrue(DROP +TEST_THE_UNDO,((Diagram)getRootView()).getEdges().size()==0);
+ assertTrue(DROP + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 5);
+ assertTrue(DROP + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DROP +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==5);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==1);
+ assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 5);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
}
/**
* Test change container.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
public void testChangeContainer(IElementType type, IElementType containerType) {
//CHANGE CONTAINER
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==1);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
- Request requestcreation=CreateViewRequestFactory.getCreateShapeRequest(containerType, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CONTAINER_CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CONTAINER_CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==2);
- GraphicalEditPart containerEditPart= (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ assertTrue(CONTAINER_CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 2);
+ GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
ChangeBoundsRequest changeBoundsRequest = new ChangeBoundsRequest(RequestConstants.REQ_ADD);
changeBoundsRequest.setEditParts((EditPart)getDiagramEditPart().getChildren().get(0));
- changeBoundsRequest.setLocation(new Point(30,30));
- ShapeCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <containerEditPart.getChildren().size()){
- if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart){
- compartment= (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
+ changeBoundsRequest.setLocation(new Point(30, 30));
+ ShapeCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < containerEditPart.getChildren().size()) {
+ if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
+ compartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
- command=compartment.getCommand(changeBoundsRequest);
- assertNotNull(CHANGE_CONTAINER,command);
- assertTrue(CHANGE_CONTAINER+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(CHANGE_CONTAINER+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ command = compartment.getCommand(changeBoundsRequest);
+ assertNotNull(CHANGE_CONTAINER, command);
+ assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,getRootView().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,getRootView().getChildren().size()==2);
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==2);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootView().getChildren().size() == 2);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 2);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,getRootView().getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootView().getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
}
/**
* Test to create a link.
*
- * @param linkType the type
+ * @param linkType
+ * the type
*/
public void testToCreateALink(IElementType linkType) {
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTru