Skip to content
Snippets Groups Projects
Commit d27c9b6d authored by Stefano puri's avatar Stefano puri
Browse files

[334] Update API doc

    
The packages structure has been reviewed. Java doc has been added.
    
Bug: https://polarsys.org/bugs/show_bug.cgi?id=334
parent 292c3891
No related branches found
No related tags found
No related merge requests found
Showing
with 1130 additions and 982 deletions
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.polarsys.chess.service</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.polarsys.chess.service</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CHESS Service plug-in (Incubation)
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.chess.service;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.polarsys.chess.service.Activator
Bundle-Activator: org.polarsys.chess.service.internal.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.core,
org.eclipse.emf.transaction,
org.polarsys.chess.core,
org.eclipse.ui.workbench,
org.eclipse.jface,
org.eclipse.ui;bundle-version="3.106.0",
org.eclipse.emf.cdo.ui.ide;bundle-version="4.1.100",
org.eclipse.gef,
org.eclipse.papyrus.editor,
org.eclipse.gmf.runtime.diagram.ui,
org.eclipse.uml2.uml,
org.eclipse.papyrus.views.modelexplorer,
org.eclipse.papyrus.emf.facet.custom.metamodel,
com.google.guava,
org.eclipse.papyrus.infra.gmfdiag.common,
org.eclipse.uml2.uml.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.polarsys.chess.service.utils
org.eclipse.uml2.uml,
org.eclipse.emf.cdo.ui.ide
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.polarsys.chess.service.internal.utils;x-internal:=true,
org.polarsys.chess.service.utils;
uses:="org.eclipse.ui,
org.eclipse.papyrus.infra.core.services,
org.eclipse.papyrus.editor,
org.eclipse.gmf.runtime.diagram.ui.parts,
org.eclipse.jface.dialogs,
org.eclipse.gmf.runtime.diagram.ui.editparts,
org.eclipse.gmf.runtime.notation,
org.polarsys.chess.core.views,
org.eclipse.ui.part"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
pluginName = CHESS Service plug-in (Incubation)
providerName = University of Padua
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.services">
<sourceProvider
provider="org.polarsys.chess.service.commands.SwitchSourceProvider">
<variable
name="org.polarsys.chess.service.commands.switchState"
priorityLevel="workbench">
</variable>
</sourceProvider>
</extension>
<extension
point="org.eclipse.papyrus.infra.core.service">
<serviceFactory
classname="org.polarsys.chess.service.CHESSServiceFactory"
description="The service loading CHESS editor support"
id="org.polarsys.chess.service.CHESSService"
priority="1"
startKind="startup">
<dependsOn
serviceKeyRef="org.eclipse.papyrus.infra.core.resource.ModelSet">
</dependsOn>
</serviceFactory>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Extra-Functional View"
id="org.polarsys.chess.service.switchEFCommand"
name="Activate Extra-Functional View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Railway View"
id="org.polarsys.chess.service.switchRailCommand"
name="Activate Railway View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Dependability View"
id="org.polarsys.chess.service.switchDEPCommand"
name="Activate Dependability View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<category
description="CHESS Commands"
id="org.polarsys.chess.commands.category"
name="CHESS">
</category>
<command
categoryId="org.polarsys.chess.commands.category"
defaultHandler="org.polarsys.chess.service.commands.CurrentViewStatus"
description="Shows the active design view"
id="org.polarsys.chess.service.CurrentViewStatus"
name="CurrentView">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchEFCommand"
icon="icons/switch.gif"
id="org.polarsys.chess.service.switchEFCommandToolbar"
label="Activate extra-functional view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchRailCommand"
icon="icons/switchRAIL.gif"
id="org.polarsys.chess.service.switchRailCommandToolbar"
label="Activate Railway view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchDEPCommand"
icon="icons/switchDEP.gif"
id="org.polarsys.chess.service.switchDEPCommandToolbar"
label="Activate Dependability view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.statustoolbar"
label="CHESS Status Toolbar">
<command
commandId="org.polarsys.chess.service.CurrentViewStatus"
icon="icons/NullView.gif"
style="push">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchEFCommand"
icon="icons/switch.gif"
id="org.polarsys.chess.service.switchEFCommandMenu"
label="Activate extra-functional view"
mnemonic="S"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchRailCommand"
icon="icons/switchRAIL.gif"
id="org.polarsys.chess.service.switchRailCommandMenu"
label="Activate Railway view"
mnemonic="R"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchDEPCommand"
icon="icons/switchDEP.gif"
id="org.polarsys.chess.service.switchDEPCommandMenu"
label="Activate Dependability view"
mnemonic="p"
style="toggle">
</command>
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbarDebug"
label="CHESS Debug Toolbar">
<command
commandId="org.polarsys.chess.command.superuser"
icon="icons/CHESSsuperuser.gif"
style="push">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.commands.SwitchToExtraFunctional"
commandId="org.polarsys.chess.service.switchEFCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="ExtraFunctionalView">
</equals>
<equals
value="ComponentView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.commands.SwitchToRailway"
commandId="org.polarsys.chess.service.switchRailCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="ExtraFunctionalView">
</equals>
<equals
value="ExtraFunctionalView-RailwayView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.commands.SwitchToDependability"
commandId="org.polarsys.chess.service.switchDEPCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="DependabilityView">
</equals>
<equals
value="DeploymentView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.polarsys.chess.selectionListener">
<listener
name="selection listener"
realization="org.polarsys.chess.service.SelectionListener">
</listener>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
description="CHESS Debug Commands"
id="org.polarsys.chess.categoryDebug"
name="CHESS Debug Commands">
</category>
<command
categoryId="org.polarsys.chess.categoryDebug"
defaultHandler="org.polarsys.chess.service.commands.SupersuserToggleCommand"
id="org.polarsys.chess.command.superuser"
name="disable the checking of read/write permissions">
</command>
</extension>
<!--<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbarDebug"
label="chess.toolbarDebug">
<command
commandId="org.polarsys.chess.command.superuser"
icon="icons/CHESSsuperuser.gif"
label="xml"
style="toggle">
</command>
<visibleWhen
checkEnabled="false">
<with
variable="activeEditorId">
<equals
value="org.eclipse.papyrus.infra.core.papyrusEditor">
</equals>
</with>
</visibleWhen>
</toolbar>
</menuContribution>
</extension>-->
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.services">
<sourceProvider
provider="org.polarsys.chess.service.internal.commands.switchers.SwitchSourceProvider">
<variable
name="org.polarsys.chess.service.commands.switchState"
priorityLevel="workbench">
</variable>
</sourceProvider>
</extension>
<extension
point="org.eclipse.papyrus.infra.core.service">
<serviceFactory
classname="org.polarsys.chess.service.internal.service.CHESSServiceFactory"
description="The service loading the CHESS editor support"
id="org.polarsys.chess.service.internal.service.CHESSService"
priority="1"
startKind="startup">
<dependsOn
serviceKeyRef="org.eclipse.papyrus.infra.core.resource.ModelSet">
</dependsOn>
</serviceFactory>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Extra-Functional View"
id="org.polarsys.chess.service.switchEFCommand"
name="Activate Extra-Functional View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Railway View"
id="org.polarsys.chess.service.switchRailCommand"
name="Activate Railway View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="org.polarsys.chess.commands.category"
description="Activate Dependability View"
id="org.polarsys.chess.service.switchDEPCommand"
name="Activate Dependability View">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<category
description="CHESS Commands"
id="org.polarsys.chess.commands.category"
name="CHESS">
</category>
<command
categoryId="org.polarsys.chess.commands.category"
defaultHandler="org.polarsys.chess.service.internal.commands.CurrentViewStatusCommand"
description="Shows the active design view"
id="org.polarsys.chess.service.CurrentViewStatus"
name="CurrentView">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchEFCommand"
icon="icons/switch.gif"
id="org.polarsys.chess.service.switchEFCommandToolbar"
label="Activate extra-functional view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchRailCommand"
icon="icons/switchRAIL.gif"
id="org.polarsys.chess.service.switchRailCommandToolbar"
label="Activate Railway view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.toolbar"
label="CHESS Toolbar">
<command
commandId="org.polarsys.chess.service.switchDEPCommand"
icon="icons/switchDEP.gif"
id="org.polarsys.chess.service.switchDEPCommandToolbar"
label="Activate Dependability view"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
<toolbar
id="org.polarsys.chess.statustoolbar"
label="CHESS Status Toolbar">
<command
commandId="org.polarsys.chess.service.CurrentViewStatus"
icon="icons/NullView.gif"
style="push">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchEFCommand"
icon="icons/switch.gif"
id="org.polarsys.chess.service.switchEFCommandMenu"
label="Activate extra-functional view"
mnemonic="S"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchRailCommand"
icon="icons/switchRAIL.gif"
id="org.polarsys.chess.service.switchRailCommandMenu"
label="Activate Railway view"
mnemonic="R"
style="toggle">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<command
commandId="org.polarsys.chess.service.switchDEPCommand"
icon="icons/switchDEP.gif"
id="org.polarsys.chess.service.switchDEPCommandMenu"
label="Activate Dependability view"
mnemonic="p"
style="toggle">
</command>
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbarDebug"
label="CHESS Debug Toolbar">
<command
commandId="org.polarsys.chess.command.superuser"
icon="icons/CHESSsuperuser.gif"
style="push">
<visibleWhen
checkEnabled="false">
<and>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</and>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.internal.commands.switchers.SwitchToExtraFunctionalCommand"
commandId="org.polarsys.chess.service.switchEFCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="ExtraFunctionalView">
</equals>
<equals
value="ComponentView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.internal.commands.switchers.SwitchToRailwayCommand"
commandId="org.polarsys.chess.service.switchRailCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="ExtraFunctionalView">
</equals>
<equals
value="ExtraFunctionalView-RailwayView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.polarsys.chess.service.internal.commands.switchers.SwitchToDependabilityCommand"
commandId="org.polarsys.chess.service.switchDEPCommand">
<enabledWhen>
<with
variable="org.polarsys.chess.service.commands.switchState">
<or>
<equals
value="DependabilityView">
</equals>
<equals
value="DeploymentView">
</equals>
</or>
</with>
</enabledWhen>
</handler>
</extension>
<extension
point="org.polarsys.chess.selectionListener">
<listener
name="selection listener"
realization="org.polarsys.chess.service.internal.service.SelectionListener">
</listener>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
description="CHESS Debug Commands"
id="org.polarsys.chess.categoryDebug"
name="CHESS Debug Commands">
</category>
<command
categoryId="org.polarsys.chess.categoryDebug"
defaultHandler="org.polarsys.chess.service.internal.commands.SupersuserToggleCommand"
id="org.polarsys.chess.command.superuser"
name="disable the checking of read/write permissions">
</command>
</extension>
<!--<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="org.polarsys.chess.toolbarDebug"
label="chess.toolbarDebug">
<command
commandId="org.polarsys.chess.command.superuser"
icon="icons/CHESSsuperuser.gif"
label="xml"
style="toggle">
</command>
<visibleWhen
checkEnabled="false">
<with
variable="activeEditorId">
<equals
value="org.eclipse.papyrus.infra.core.papyrusEditor">
</equals>
</with>
</visibleWhen>
</toolbar>
</menuContribution>
</extension>-->
</plugin>
package org.polarsys.chess.service.exceptions;
public class NoDiagramStatusException extends Exception {
private static final long serialVersionUID = 2851754756173385325L;
}
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
public static final String PLUGIN_ID = "org.polarsys.chess.service"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
static BundleContext getContext() {
return context;
}
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
plugin = this;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
plugin = null;
}
public static Activator getDefault() {
return plugin;
}
}
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.internal;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.polarsys.chess.service"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
public void start(BundleContext bundleContext) throws Exception {
super.start(bundleContext);
plugin = this;
}
public void stop(BundleContext bundleContext) throws Exception {
plugin = null;
super.stop(bundleContext);
}
public static Activator getDefault() {
return plugin;
}
public static void error(String message, Throwable e) {
String msg = null;
if (message == null)
msg = e.getMessage();
else
msg = String.format("%s: %s", message, e.getMessage());
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, msg, e);
plugin.getLog().log(status);
}
public static void info(String message) {
IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, message);
plugin.getLog().log(status);
}
}
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
package org.polarsys.chess.service.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
......@@ -27,15 +27,17 @@ import org.polarsys.chess.core.natures.CHESSNature;
public class MatchingStrategy implements IEditorMatchingStrategy {
public boolean matches(IEditorReference editorRef, IEditorInput input) {
boolean match = false;
IFile file = ((IFileEditorInput)input).getFile();
try {
if(file.getProject().hasNature(CHESSNature.NATURE_ID)){
return true;
match = true;
}
} catch (CoreException e) {
e.printStackTrace();
Activator.error("Errors in MatchingStrategy", e);
}
return false;
return match;
}
}
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands;
import java.util.Map;
......@@ -28,13 +28,14 @@ import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.CHESSService;
import org.polarsys.chess.service.CHESSServiceFactory;
import org.polarsys.chess.service.internal.commands.switchers.SwitchSourceProvider;
import org.polarsys.chess.service.internal.service.CHESSService;
import org.polarsys.chess.service.internal.service.CHESSServiceFactory;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class CurrentViewStatus extends AbstractHandler implements IElementUpdater {
public class CurrentViewStatusCommand extends AbstractHandler implements IElementUpdater {
public CurrentViewStatus() {
public CurrentViewStatusCommand() {
SwitchSourceProvider.commandsToRefresh.add(COMMAND_ID);
}
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands;
import java.util.Map;
......@@ -41,7 +41,7 @@ public class SupersuserToggleCommand extends AbstractHandler implements IElement
throws org.eclipse.core.commands.ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
;
if (CHESSEditorUtils.isCHESSProject(editor) && CHESSProfileManager.ARE_VIEWS_LOADED) {
DiagramStatus diagramStatus = CHESSEditorUtils.getDiagramStatus((PapyrusMultiDiagramEditor) editor);
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands.switchers;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -27,6 +27,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISources;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.part.WorkbenchPart;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.core.views.DiagramStatus.DesignView;
import org.polarsys.chess.core.views.ViewUtils;
......@@ -42,9 +43,6 @@ public class SwitchSourceProvider extends AbstractSourceProvider {
public static List<String> commandsToRefresh = new ArrayList<String>();
// public final static String VIEW = "org.polarsys.chess.service.commands.currentView";
// String viewName;
public void dispose() {
}
......@@ -57,7 +55,7 @@ public class SwitchSourceProvider extends AbstractSourceProvider {
}
public String[] getProvidedSourceNames() {
return new String[] { SWITCH/*, VIEW*/ };
return new String[] { SWITCH };
}
private void setEnabledValue(String v) {
......@@ -70,7 +68,7 @@ public class SwitchSourceProvider extends AbstractSourceProvider {
if (!CHESSEditorUtils.isCHESSProject(activeEditor)) {
setEnabledValue(DISABLED);
} else {
DiagramStatus ds = CHESSEditorUtils.getDiagramStatus((PapyrusMultiDiagramEditor) activeEditor);
if (ds == null) {
setEnabledValue(DISABLED);
......@@ -80,8 +78,6 @@ public class SwitchSourceProvider extends AbstractSourceProvider {
if (currentView != null && (ViewUtils.hasConcurrentViews(currentView) || ViewUtils.isConcurrentView(currentView))){
String name = ViewUtils.getBaseViewName(currentView);
setEnabledValue(name);
// System.out.println("base view name " + name);
// System.out.println("active view " + ((CHESSEditor) activeEditor).getDiagramStatus().getActiveView());
}
......@@ -89,15 +85,14 @@ public class SwitchSourceProvider extends AbstractSourceProvider {
setEnabledValue(DISABLED);
}
}
refreshElements();
refreshElements(activeEditor);
} catch (Exception e) {
return;
}
}
private void refreshElements() {
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getService(ICommandService.class);
private void refreshElements(IEditorPart activeEditor) {
ICommandService service = (ICommandService) activeEditor.getSite().getWorkbenchWindow().getService(ICommandService.class);
for (String commandId : commandsToRefresh) {
service.refreshElements(commandId, null);
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands.switchers;
import java.util.Map;
......@@ -25,7 +25,7 @@ import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
public class SwitchToDependability extends AbstractHandler implements
public class SwitchToDependabilityCommand extends AbstractHandler implements
IElementUpdater {
public static String COMMAND_ID = "org.polarsys.chess.service.switchDEPCommand";
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands.switchers;
import java.util.Map;
......@@ -25,7 +25,7 @@ import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
public class SwitchToExtraFunctional extends AbstractHandler implements
public class SwitchToExtraFunctionalCommand extends AbstractHandler implements
IElementUpdater {
public static String COMMAND_ID = "org.polarsys.chess.service.switchEFCommand";
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands.switchers;
import java.util.Map;
......@@ -25,7 +25,7 @@ import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
public class SwitchToRailway extends AbstractHandler implements
public class SwitchToRailwayCommand extends AbstractHandler implements
IElementUpdater {
public static String COMMAND_ID = "org.polarsys.chess.service.switchRailCommand";
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.commands.switchers;
import java.util.ArrayList;
import java.util.List;
......@@ -33,7 +33,10 @@ import org.eclipse.ui.menus.UIElement;
import org.eclipse.ui.services.ISourceProviderService;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.PaletteManager;
import org.polarsys.chess.core.views.DiagramStatus.DesignView;
import org.polarsys.chess.service.internal.palette.PaletteManager;
import org.polarsys.chess.service.internal.utils.CHESSInternalEditorUtils;
import org.polarsys.chess.service.internal.visibility.HidePortCommand;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class SwitchToView {
......@@ -88,12 +91,12 @@ public class SwitchToView {
return null;
}
//TODO extends
//TODO currently this method does not work. Do no use it.
private void hideShowElements(PapyrusMultiDiagramEditor editor) {
if (false){
List<View> elements = new ArrayList<View>();
try {
elements = CHESSEditorUtils.getDiagramAllVisiblePort(CHESSEditorUtils.getDiagram(editor));
elements = CHESSInternalEditorUtils.getDiagramAllVisiblePort(CHESSEditorUtils.getDiagram(editor));
new HidePortCommand(elements, editor).execute();
} catch (Exception e) {}
}
......@@ -107,8 +110,9 @@ public class SwitchToView {
if (st== null)
return;
// System.out.println("switcher for " + theView);
selected = selected
&& st.getCurrentView().isEnabled(theView);
DesignView currentView = st.getCurrentView();
if(selected && currentView != null)
selected = st.getCurrentView().isEnabled(theView);
}
element.setChecked(selected);
if (selected)
......
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
package org.polarsys.chess.service.internal.palette;
import java.util.List;
......
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
import java.net.URL;
import java.util.Hashtable;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
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.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
import org.polarsys.chess.core.resourcelistener.ResourceSetListenerManager;
import org.polarsys.chess.core.resourcelistener.SelectionListenerManager;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class CHESSService {
private static final String ICON_LOCATION = "org.polarsys.chess.service";
public static Hashtable<String, ImageDescriptor> viewIcons = new Hashtable<String, ImageDescriptor>();
private ISashWindowsContainer container;
private ServicesRegistry serviceRegistry;
private DiagramStatus diagramStatus;
private SelectionListenerManager selectionListener;
private ResourceSetListenerManager resourceListener;
private TransactionalEditingDomain editingDomain;
private IEditorPart currentEditor;
private IWorkbenchPage currentPage;
public CHESSService(ISashWindowsContainer container, ServicesRegistry registry) {
this.container = container;
serviceRegistry = registry;
}
public boolean start(IWorkbenchPart part) {
IEditorPart activeEditor = container.getActiveEditor();
if (activeEditor!=null && CHESSEditorUtils.isCHESSProject(activeEditor)) {
initializeCHESS(activeEditor);
return true;
}
if (activeEditor == null) {
//waitForActiveEditor();
//return true;
try {
if (part instanceof PapyrusMultiDiagramEditor){
PapyrusMultiDiagramEditor editor = (PapyrusMultiDiagramEditor)part;
serviceRegistry = (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
container = serviceRegistry.getService(ISashWindowsContainer.class);
if (CHESSEditorUtils.isCHESSProject(editor)) {
initializeCHESS(editor);
return true;
}
}
} catch (ServiceException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return false;
}
private void initializeCHESS(IEditorPart activeEditor) {
System.err.println("CHESS Service initialized...");
ModelSet modelSet = null;
//ISashWindowsContainer container = null;
try {
modelSet = serviceRegistry.getService(ModelSet.class);
container = ServiceUtils.getInstance().getISashWindowsContainer(
serviceRegistry);
diagramStatus = new DiagramStatus(
container.getActiveSashWindowsPage());
editingDomain = modelSet
.getTransactionalEditingDomain();
CHESSProfileManager
.loadCHESSProfile(editingDomain.getResourceSet());
//let plugins to load external profiles
CHESSProfileManager.loadExternalProfiles(editingDomain.getResourceSet());
resourceListener = new ResourceSetListenerManager(
serviceRegistry);
editingDomain
.addResourceSetListener(resourceListener);
//serviceRegistry.add(DiagramStatus.class, 5, diagramStatus);
selectionListener = new SelectionListenerManager(
serviceRegistry);
currentEditor = activeEditor;
currentPage = currentEditor.getSite().getPage();
currentPage.addSelectionListener(selectionListener);
loadIcons();
} catch (ServiceException e) {
e.printStackTrace();
}
}
public void stopService(){
currentPage.removeSelectionListener(selectionListener);
editingDomain.removeResourceSetListener(resourceListener);
}
private void loadIcons() {
// Load view icons
if (!viewIcons.keySet().isEmpty()){
return;
}
URL nullFile = FileLocator.find(Platform
.getBundle(ICON_LOCATION), new Path(
"icons/NullView.gif"), null);
ImageDescriptor icon = ImageDescriptor.createFromURL(nullFile);
viewIcons.put(CHESSProfileManager.NULL_VIEW, icon);
for (String v : CHESSProfileManager.CHESS_VIEWS_LIST) {
URL file = FileLocator.find(
Platform.getBundle(ICON_LOCATION),
new Path("icons/" + v + ".gif"), null);
if (file != null) {
icon = ImageDescriptor.createFromURL(file);
} else {
icon = ImageDescriptor.createFromURL(nullFile);
}
viewIcons.put(v, icon);
}
}
public void unload() {
// TODO Auto-generated method stub
}
public DiagramStatus getDiagramStatus() {
return diagramStatus;
}
}
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.internal.service;
import java.net.URL;
import java.util.Hashtable;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
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.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.polarsys.chess.core.profiles.CHESSProfileManager;
import org.polarsys.chess.core.resourcelistener.ResourceSetListenerManager;
import org.polarsys.chess.core.resourcelistener.SelectionListenerManager;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.internal.Activator;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class CHESSService {
private static final String ICON_LOCATION = "org.polarsys.chess.service";
public static Hashtable<String, ImageDescriptor> viewIcons = new Hashtable<String, ImageDescriptor>();
private ISashWindowsContainer container;
private ServicesRegistry serviceRegistry;
private DiagramStatus diagramStatus;
private SelectionListenerManager selectionListener;
private ResourceSetListenerManager resourceListener;
private TransactionalEditingDomain editingDomain;
private IEditorPart currentEditor;
private IWorkbenchPage currentPage;
public CHESSService(ISashWindowsContainer container, ServicesRegistry registry) {
this.container = container;
serviceRegistry = registry;
}
public boolean start(IWorkbenchPart part) {
IEditorPart activeEditor = container.getActiveEditor();
if (activeEditor!=null && CHESSEditorUtils.isCHESSProject(activeEditor)) {
initializeCHESS(activeEditor);
return true;
}
if (activeEditor == null) {
//waitForActiveEditor();
//return true;
try {
if (part instanceof PapyrusMultiDiagramEditor){
PapyrusMultiDiagramEditor editor = (PapyrusMultiDiagramEditor)part;
serviceRegistry = (ServicesRegistry)editor.getAdapter(ServicesRegistry.class);
container = serviceRegistry.getService(ISashWindowsContainer.class);
if (CHESSEditorUtils.isCHESSProject(editor)) {
initializeCHESS(editor);
return true;
}
}
} catch (ServiceException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return false;
}
private void initializeCHESS(IEditorPart activeEditor) {
ModelSet modelSet = null;
//ISashWindowsContainer container = null;
try {
modelSet = serviceRegistry.getService(ModelSet.class);
container = ServiceUtils.getInstance().getISashWindowsContainer(
serviceRegistry);
diagramStatus = new DiagramStatus(
container.getActiveSashWindowsPage());
editingDomain = modelSet
.getTransactionalEditingDomain();
CHESSProfileManager
.loadCHESSProfile(editingDomain.getResourceSet());
//let plugins to load external profiles
CHESSProfileManager.loadExternalProfiles(editingDomain.getResourceSet());
resourceListener = new ResourceSetListenerManager(
serviceRegistry);
editingDomain
.addResourceSetListener(resourceListener);
//serviceRegistry.add(DiagramStatus.class, 5, diagramStatus);
selectionListener = new SelectionListenerManager(
serviceRegistry);
currentEditor = activeEditor;
currentPage = currentEditor.getSite().getPage();
currentPage.addSelectionListener(selectionListener);
loadIcons();
//System.err.println("CHESS Service initialized...");
Activator.info("CHESS Service has been initialized.");
} catch (ServiceException e) {
Activator.error("Errors during CHESS service initialization", e);
}
}
public void stopService(){
currentPage.removeSelectionListener(selectionListener);
editingDomain.removeResourceSetListener(resourceListener);
//System.err.println("CHESS Service terminated.");
Activator.info("CHESS Service has been terminated.");
}
private void loadIcons() {
// Load view icons
if (!viewIcons.keySet().isEmpty()){
return;
}
URL nullFile = FileLocator.find(Platform
.getBundle(ICON_LOCATION), new Path(
"icons/NullView.gif"), null);
ImageDescriptor icon = ImageDescriptor.createFromURL(nullFile);
viewIcons.put(CHESSProfileManager.NULL_VIEW, icon);
for (String v : CHESSProfileManager.CHESS_VIEWS_LIST) {
URL file = FileLocator.find(
Platform.getBundle(ICON_LOCATION),
new Path("icons/" + v + ".gif"), null);
if (file != null) {
icon = ImageDescriptor.createFromURL(file);
} else {
icon = ImageDescriptor.createFromURL(nullFile);
}
viewIcons.put(v, icon);
}
}
public void unload() {
// TODO Auto-generated method stub
}
public DiagramStatus getDiagramStatus() {
return diagramStatus;
}
}
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.IServiceFactory;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
public class CHESSServiceFactory implements IServiceFactory {
private CHESSService service;
private ServicesRegistry serviceRegistry;
private ISashWindowsContainer container;
private IPartListener partListener;
/*
* This service attach a PartListener upon its initialization to retrieve the needed ISashWindowsContainer service.
* The ISashWindowsContainer service, in fact, is available only after the
* actual service registry initialization (it is not strictly part of the service framework).
*
* Once the CHESS service is correctly started, the listener is removed.
* */
@Override
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
this.serviceRegistry = servicesRegistry;
IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
partListener = createPartListener();
w.getPartService().addPartListener(partListener);
}
private IPartListener createPartListener() {
return new IPartListener() {
private void execute(IWorkbenchPart part) {
if (part instanceof PapyrusMultiDiagramEditor) {
try {
container = serviceRegistry.getService(ISashWindowsContainer.class);
createCHESSService();
boolean b = service.start(part);
if(b) {
removePartListner(this);
} else {
service = null;
}
} catch (ServiceException e) {
/*if ISashWindowsContainer does not exist probably the CHESS service was initialised during the
* creation of the CHESS model => nothing can be done other than removing the listener*/
//System.err.println(e.getMessage());
service = null;
removePartListner(this);
}
}
}
@Override
public void partOpened(IWorkbenchPart part) {
execute(part);
}
@Override
public void partDeactivated(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partClosed(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partActivated(IWorkbenchPart part) {
execute(part);
}
};
}
@Override
public void startService() throws ServiceException {
}
@Override
public void disposeService() throws ServiceException {
removePartListner(partListener);
if (service !=null){
System.err.println("CHESS Service terminated.");
service.stopService();
service = null;
}
}
private void removePartListner(IPartListener partListener) {
if (partListener != null)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().removePartListener(partListener);
}
private void createCHESSService() {
service = new CHESSService(container, serviceRegistry);
}
@Override
public Object createServiceInstance() throws ServiceException {
return service;
}
}
/*
-----------------------------------------------------------------------
-- CHESS core plugin --
-- --
-- Copyright (C) 2014 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.internal.service;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.services.IServiceFactory;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
public class CHESSServiceFactory implements IServiceFactory {
private CHESSService service;
private ServicesRegistry serviceRegistry;
private ISashWindowsContainer container;
private IPartListener partListener;
/*
* This service attach a PartListener upon its initialization to retrieve the needed ISashWindowsContainer service.
* The ISashWindowsContainer service, in fact, is available only after the
* actual service registry initialization (it is not strictly part of the service framework).
*
* Once the CHESS service is correctly started, the listener is removed.
* */
@Override
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
this.serviceRegistry = servicesRegistry;
IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
partListener = createPartListener();
w.getPartService().addPartListener(partListener);
}
private IPartListener createPartListener() {
return new IPartListener() {
private void execute(IWorkbenchPart part) {
if (part instanceof PapyrusMultiDiagramEditor) {
try {
container = serviceRegistry.getService(ISashWindowsContainer.class);
createCHESSService();
boolean success = service.start(part);
if(success) {
removePartListner(this);
} else {
service = null;
}
} catch (ServiceException e) {
/*if ISashWindowsContainer does not exist probably the CHESS service was initialised during the
* creation of the CHESS model => nothing can be done other than removing the listener*/
//System.err.println(e.getMessage());
service = null;
removePartListner(this);
}
}
}
@Override
public void partOpened(IWorkbenchPart part) {
execute(part);
}
@Override
public void partDeactivated(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partClosed(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
@Override
public void partActivated(IWorkbenchPart part) {
execute(part);
}
};
}
@Override
public void startService() throws ServiceException {
}
@Override
public void disposeService() throws ServiceException {
removePartListner(partListener);
if (service !=null){
service.stopService();
service = null;
}
}
private void removePartListner(IPartListener partListener) {
if (partListener != null)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().removePartListener(partListener);
}
private void createCHESSService() {
service = new CHESSService(container, serviceRegistry);
}
@Override
public Object createServiceInstance() throws ServiceException {
return service;
}
}
/*
-----------------------------------------------------------------------
-- CHESS editor plugin --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.services.ISourceProviderService;
import org.eclipse.ui.views.properties.PropertySheet;
import org.polarsys.chess.core.resourcelistener.SelectionListenerExtra;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.commands.SwitchSourceProvider;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class SelectionListener extends SelectionListenerExtra {
DiagramStatus diagramStatus = null;
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
// lazy association
if (diagramStatus == null)
diagramStatus = CHESSEditorUtils.getDiagramStatus(getRegistry());
if (diagramStatus == null) {
return;
}
diagramStatus.setUserAction(true);
if (part instanceof PropertySheet) {
part = ((PropertySheet) part).getSite().getWorkbenchWindow()
.getActivePage().getActiveEditor();
}
// if (part instanceof IEditorPart && CHESSEditorUtils.isCHESSProject((IEditorPart)part) && CHESSEditorUtils.isModelEditor(part)) {
if (part instanceof PapyrusMultiDiagramEditor && CHESSEditorUtils.isCHESSProject((IEditorPart)part)) {
// listens to sash page change events in the editor
PapyrusMultiDiagramEditor editor = (PapyrusMultiDiagramEditor) part;
IPage newPage = (editor).getISashWindowsContainer()
.getActiveSashWindowsPage();
// System.out.println("PAGE:" + newPage);
diagramStatus.setActualView(newPage);
// enable/disable palettes
PaletteManager.setPaletteVisibility(editor, diagramStatus);
} else if (part instanceof ModelExplorerPageBookView
&& selection instanceof TreeSelection && !selection.isEmpty()) {
// listens to model element selection in Model Explorer
TreeSelection tSelection = (TreeSelection) selection;
Object fElement = tSelection.getFirstElement();
if (fElement instanceof EObjectTreeElementImpl) {
diagramStatus.setActualView(tSelection);
}
}
IWorkbenchWindow window = null;
try {
window = part.getSite().getWorkbenchWindow();
} catch (Exception e) {
//Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
return;
}
if (window.getActivePage() != null) {
// Enable/disable the switch to extra-functional view command
// Enable when the current view is the functional view
ISourceProviderService spService = (ISourceProviderService) window
.getService(ISourceProviderService.class);
SwitchSourceProvider sp = (SwitchSourceProvider) spService
.getSourceProvider(SwitchSourceProvider.SWITCH);
sp.updateStatus(window.getActivePage().getActiveEditor());
}
}
}
/*
-----------------------------------------------------------------------
-- CHESS editor plugin --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.internal.service;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.services.ISourceProviderService;
import org.eclipse.ui.views.properties.PropertySheet;
import org.polarsys.chess.core.resourcelistener.SelectionListenerExtra;
import org.polarsys.chess.core.views.DiagramStatus;
import org.polarsys.chess.service.exceptions.NoDiagramStatusException;
import org.polarsys.chess.service.internal.Activator;
import org.polarsys.chess.service.internal.commands.switchers.SwitchSourceProvider;
import org.polarsys.chess.service.internal.palette.PaletteManager;
import org.polarsys.chess.service.utils.CHESSEditorUtils;
public class SelectionListener extends SelectionListenerExtra {
DiagramStatus diagramStatus = null;
private void retrieveDiagramStatus() throws NoDiagramStatusException{
// lazy association
if (diagramStatus == null)
diagramStatus = CHESSEditorUtils.getDiagramStatus(getRegistry());
if (diagramStatus == null) {
throw new NoDiagramStatusException();
}
}
private void processPart(IWorkbenchPart part, ISelection selection){
if (part instanceof PropertySheet) {
/*get the actual active editor*/
part = ((PropertySheet) part).getSite().getWorkbenchWindow()
.getActivePage().getActiveEditor();
} else if (part instanceof PapyrusMultiDiagramEditor &&
CHESSEditorUtils.isCHESSProject((IEditorPart)part)) {
// listens to sash page change events in the editor and
// modify the view
PapyrusMultiDiagramEditor editor = (PapyrusMultiDiagramEditor) part;
IPage activePage = (editor).getISashWindowsContainer()
.getActiveSashWindowsPage();
diagramStatus.setActualView(activePage);
// enable/disable palette according to current view
PaletteManager.setPaletteVisibility(editor, diagramStatus);
} else if (part instanceof ModelExplorerPageBookView
&& selection instanceof TreeSelection && !selection.isEmpty()) {
// listens to model element selection in Model Explorer
TreeSelection tSelection = (TreeSelection) selection;
Object fElement = tSelection.getFirstElement();
if (fElement instanceof EObjectTreeElementImpl) {
diagramStatus.setActualView(tSelection);
}
}
}
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
try {
retrieveDiagramStatus();
diagramStatus.setUserAction(true);
processPart(part, selection);
IWorkbenchWindow window = part.getSite().getWorkbenchWindow();
if (window.getActivePage() != null) {
updateStatus(window);
}
} catch (NoDiagramStatusException e1) {
Activator.error(null, e1);
} catch (Exception e2) {
Activator.error(null, e2);
}
}
/**
* Enable/disable the switch to extra-functional view command
* Enable when the current view is the functional view
*/
private void updateStatus(IWorkbenchWindow window) {
ISourceProviderService spService = (ISourceProviderService) window
.getService(ISourceProviderService.class);
SwitchSourceProvider sp = (SwitchSourceProvider) spService
.getSourceProvider(SwitchSourceProvider.SWITCH);
sp.updateStatus(window.getActivePage().getActiveEditor());
}
}
/*
-----------------------------------------------------------------------
-- CHESS editor plugin --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Alessandro Zovi azovi@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.internal.utils;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.uml2.uml.Port;
import org.polarsys.chess.service.internal.Activator;
public class CHESSInternalEditorUtils {
static public List<View> getDiagramAllVisiblePort(final View diagram) {
List<View> list = new ArrayList<View>();
list = CHESSInternalEditorUtils.getDiagramAllVisiblePortRecur(
list, diagram);
return list;
}
static public /* @NonNull */ List<View> getDiagramAllVisiblePortRecur(/* @NonNull */ final List<View> list,
/* @NonNull */ final View view) {
for (Object v : view.getVisibleChildren()) {
if (!(v instanceof View))
continue;
if (((View) v).getElement() instanceof Port)
list.add((View) v);
getDiagramAllVisiblePortRecur(list, (View) v);
}
return list;
}
public static /*@Nullable*/IEditorPart getEditor() {
IEditorPart editor = null;
try {
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getActiveEditor();
} catch (Exception e) {
Activator.error("Editor not found", e);
}
return editor;
}
public static int StatusDialog( EditorPart editor, String dialogTitle,
String dialogMessage, IStatus status) {
ErrorDialog errDlg = new ErrorDialog(editor.getSite().getShell(),
dialogTitle, dialogMessage, status, IStatus.ERROR) {
protected void buttonPressed(int id) {
if (id == IDialogConstants.YES_ID)
id = IDialogConstants.OK_ID;
if (id == IDialogConstants.NO_ID) {
setReturnCode(5);
close();
} else {
super.buttonPressed(id);
}
}
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Details buttons
createButton(parent, IDialogConstants.YES_ID,
IDialogConstants.YES_LABEL, true);
createButton(parent, IDialogConstants.NO_ID,
IDialogConstants.NO_LABEL, true);
createDetailsButton(parent);
}
};
return errDlg.open();
}
public static MessageDialog showYesNoDialog(EditorPart editor,
String dialogTitle, String dialogMessage) {
MessageDialog md = new MessageDialog(editor.getSite().getShell(),
dialogTitle, null, dialogMessage, MessageDialog.CONFIRM,
new String[] { "Yes", "No" }, 0);
md.setBlockOnOpen(true);
return md;
}
}
......@@ -14,7 +14,7 @@
-----------------------------------------------------------------------
*/
package org.polarsys.chess.service.commands;
package org.polarsys.chess.service.internal.visibility;
import java.util.List;
......@@ -24,7 +24,9 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
class HidePortCommand {
//TODO The functionality provided by this class does not work.
//Either remove the class or investigate an alternative solution.
public class HidePortCommand {
private PapyrusMultiDiagramEditor editor;
private List<View> elements;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment