AMASS Dashboard, first draft implementation
diff --git a/org.eclipse.opencert.apm.assurproj.wizards/META-INF/MANIFEST.MF b/org.eclipse.opencert.apm.assurproj.wizards/META-INF/MANIFEST.MF
index 0295276..6a5e98c 100644
--- a/org.eclipse.opencert.apm.assurproj.wizards/META-INF/MANIFEST.MF
+++ b/org.eclipse.opencert.apm.assurproj.wizards/META-INF/MANIFEST.MF
@@ -49,3 +49,4 @@
Bundle-ClassPath: .,
lib/commons-lang3-3.1.jar
Bundle-Vendor: Tecnalia
+Export-Package: org.eclipse.opencert.apm.assurproj.wizards.ui.wizards
diff --git a/org.eclipse.opencert.infra.dashboard/.classpath b/org.eclipse.opencert.infra.dashboard/.classpath
new file mode 100644
index 0000000..8a8f166
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.opencert.infra.dashboard/.gitignore b/org.eclipse.opencert.infra.dashboard/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/org.eclipse.opencert.infra.dashboard/.project b/org.eclipse.opencert.infra.dashboard/.project
new file mode 100644
index 0000000..460c8dd
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.opencert.infra.dashboard</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.opencert.infra.dashboard/LICENSE b/org.eclipse.opencert.infra.dashboard/LICENSE
new file mode 100644
index 0000000..3534f2f
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/LICENSE
@@ -0,0 +1,277 @@
+Eclipse Public License - v 2.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial content
+ Distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate from
+ and are Distributed by that particular Contributor. A Contribution
+ "originates" from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include changes or additions to the Program that
+ are not Modified Works.
+
+"Contributor" means any person or entity that Distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare Derivative Works of, publicly display,
+ publicly perform, Distribute and sublicense the Contribution of such
+ Contributor, if any, and such Derivative Works.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in Source Code or other form. This patent license shall
+ apply to the combination of the Contribution and the Program if, at
+ the time the Contribution is added by the Contributor, such addition
+ of the Contribution causes such combination to be covered by the
+ Licensed Patents. The patent license shall not apply to any other
+ combinations which include the Contribution. No hardware per se is
+ licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to Distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ e) Notwithstanding the terms of any Secondary License, no
+ Contributor makes additional grants to any Recipient (other than
+ those set forth in this Agreement) as a result of such Recipient's
+ receipt of the Program under the terms of a Secondary License
+ (if permitted under the terms of Section 3).
+
+3. REQUIREMENTS
+
+3.1 If a Contributor Distributes the Program in any form, then:
+
+ a) the Program must also be made available as Source Code, in
+ accordance with section 3.2, and the Contributor must accompany
+ the Program with a statement that the Source Code for the Program
+ is available under this Agreement, and informs Recipients how to
+ obtain it in a reasonable manner on or through a medium customarily
+ used for software exchange; and
+
+ b) the Contributor may Distribute the Program under a license
+ different than this Agreement, provided that such license:
+ i) effectively disclaims on behalf of all other Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all other Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) does not attempt to limit or alter the recipients' rights
+ in the Source Code under section 3.2; and
+
+ iv) requires any subsequent distribution of the Program by any
+ party to be under a license that satisfies the requirements
+ of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+ a) it must be made available under this Agreement, or if the
+ Program (i) is combined with other material in a separate file or
+ files made available under a Secondary License, and (ii) the initial
+ Contributor attached to the Source Code the notice described in
+ Exhibit A of this Agreement, then the Program may be made available
+ under the terms of such Secondary Licenses, and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+
+"This Source Code may also be made available under the following
+Secondary Licenses when the conditions for such availability set forth
+in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
+version(s), and exceptions or additional permissions here}."
+
+ Simply including a copy of this Agreement, including this Exhibit A
+ is not sufficient to license the Source Code under Secondary Licenses.
+
+ If it is not possible or desirable to put the notice in a particular
+ file, then You may include the notice in a location (such as a LICENSE
+ file in a relevant directory) where a recipient would be likely to
+ look for such a notice.
+
+ You may add additional accurate notices of copyright ownership.
\ No newline at end of file
diff --git a/org.eclipse.opencert.infra.dashboard/META-INF/MANIFEST.MF b/org.eclipse.opencert.infra.dashboard/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..35e8c8d
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Opencert Dashboard
+Bundle-SymbolicName: org.eclipse.opencert.infra.dashboard;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.opencert.infra.dashboard.DashboardActivator
+Bundle-Vendor: Tecnalia
+Require-Bundle: org.eclipse.opencert.pkm.refframework.diagram;bundle-version="1.0.0",
+ org.eclipse.amalgam.explorer.activity.ui;bundle-version="1.7.0",
+ org.eclipse.ui.navigator;bundle-version="3.6.101",
+ org.eclipse.sirius;bundle-version="4.1.4",
+ org.apache.commons.lang;bundle-version="2.6.0",
+ org.eclipse.ui.ide;bundle-version="3.12.3",
+ org.eclipse.emf.common.ui;bundle-version="2.11.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.7.0",
+ org.eclipse.papyrus.infra.onefile;bundle-version="2.0.0",
+ org.eclipse.emf.cdo;bundle-version="4.5.0",
+ org.eclipse.epf.authoring.ui;bundle-version="1.5.0",
+ org.eclipse.opencert.apm.assurproj.wizards;bundle-version="1.0.0",
+ org.polarsys.chess.wizards;bundle-version="0.9.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.opencert.infra.dashboard/build.properties b/org.eclipse.opencert.infra.dashboard/build.properties
new file mode 100644
index 0000000..7e48c50
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ LICENSE,\
+ icons/
diff --git a/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_off.png b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_off.png
new file mode 100644
index 0000000..31424be
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_off.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_on.png b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_on.png
new file mode 100644
index 0000000..8c04761
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_def_on.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_icon.png b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_icon.png
new file mode 100644
index 0000000..c2ad02a
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/assurance_project_icon.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/chess_project_icon.png b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/chess_project_icon.png
new file mode 100644
index 0000000..4804d7c
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/assuranceproject/chess_project_icon.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_off.png b/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_off.png
new file mode 100644
index 0000000..36601ab
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_off.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_on.png b/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_on.png
new file mode 100644
index 0000000..7a89f1b
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/processreusability/processreusability_on.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/equivalence_mapping_icon.png b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/equivalence_mapping_icon.png
new file mode 100644
index 0000000..12dbae4
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/equivalence_mapping_icon.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/method_library_icon.png b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/method_library_icon.png
new file mode 100644
index 0000000..a8fe629
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/method_library_icon.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/refframework_diagram_icon.png b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/refframework_diagram_icon.png
new file mode 100644
index 0000000..1133c96
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/refframework_diagram_icon.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_off.png b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_off.png
new file mode 100644
index 0000000..ce9f0d3
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_off.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_on.png b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_on.png
new file mode 100644
index 0000000..e5bfa6b
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/standardcompliance/standard_compliance_def_on.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard.png b/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard.png
new file mode 100644
index 0000000..97a201c
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard_disabled.png b/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard_disabled.png
new file mode 100644
index 0000000..017b985
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/toolbar/icon_dashboard_disabled.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_off.png b/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_off.png
new file mode 100644
index 0000000..36601ab
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_off.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_on.png b/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_on.png
new file mode 100644
index 0000000..7a89f1b
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/icons/workflow/workflow_on.png
Binary files differ
diff --git a/org.eclipse.opencert.infra.dashboard/plugin.xml b/org.eclipse.opencert.infra.dashboard/plugin.xml
new file mode 100644
index 0000000..7a6306d
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/plugin.xml
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.amalgam.explorer.activity.ui.pagesProvider">
+ <Page
+ class="org.eclipse.opencert.infra.dashboard.pages.DashboardWorkflowPage"
+ id="org.eclipse.opencert.infra.dashboard.pages.dashboard"
+ imageOff="icons/workflow/workflow_off.png"
+ imageOn="icons/workflow/workflow_on.png"
+ index="0"
+ tabName="Workflow"
+ title="Workflow"
+ viewer="false">
+ <Description>
+ Dashboard in OpenCert
+ </Description>
+ <Predicate
+ class="org.eclipse.opencert.infra.dashboard.predicates.DashboardPredicate">
+ </Predicate>
+ </Page>
+ <Page
+ class="org.eclipse.opencert.infra.dashboard.pages.StandardComplianceDefinitionPage"
+ id="org.eclipse.opencert.infra.dashboard.pages.standard.compliance.definition.page"
+ imageOff="icons/standardcompliance/standard_compliance_def_off.png"
+ imageOn="icons/standardcompliance/standard_compliance_def_on.png"
+ index="1"
+ tabName="Standard Compliance Definition"
+ title="Standard Compliance Definition"
+ viewer="true">
+ <Description>
+ Standard Compliance Definition in OpenCert
+ </Description>
+ <Predicate
+ class="org.eclipse.opencert.infra.dashboard.predicates.DashboardPredicate">
+ </Predicate>
+ <Overview
+ imageOff="icons/standardcompliance/standard_compliance_def_off.png"
+ imageOn="icons/standardcompliance/standard_compliance_def_on.png">
+ <Description>
+ Define the standard compliance.
+ </Description>
+ </Overview>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.modelling.standards"
+ index="0"
+ name="Modelling Standards">
+ <Description>
+ Digitalize the standards, regulations, guidelines, best practices into a model. This can be done in a reference framework by the Assurance Manager who is an expert in standards appliance and/or a process engineer, who can model the process implicitly on a standard.
+ </Description>
+ <Activity
+ class="org.eclipse.opencert.infra.dashboard.pages.adapters.OpenNewRefframeworkDiagramWizard"
+ id="org.eclipse.opencert.infra.dashboard.activity.model.new.standard"
+ image="icons/standardcompliance/refframework_diagram_icon.png"
+ index="0"
+ name="Model a new standard/regulation/guideline">
+ <Description>
+ Model a new standard, a new regulation or a new guideline.
+ </Description>
+ </Activity>
+ <Activity
+ class="org.eclipse.opencert.infra.dashboard.pages.adapters.OpenNewMethodLibraryWizard"
+ id="org.eclipse.opencert.infra.dashboard.activity.modelling.processes.definition"
+ image="icons/standardcompliance/method_library_icon.png"
+ index="1"
+ name="Modelling of processes definitions mandated by standards">
+ <Description>
+ Modelling of processes definitions mandated by standards.
+ </Description>
+ </Activity>
+ </Section>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.standard.compliance.definition.reuse"
+ index="1"
+ name="Reuse">
+ <Description>
+ The Process Engineer can reuse existing process elements. The Assurance Manager indicates the equivalences between different standards already modelled as reference frameworks.
+ </Description>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.modelling.reusable.process.elements"
+ index="0"
+ name="Modelling of reusable process elements">
+ <Description>
+ Description body text
+ </Description>
+ </Activity>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.modelling.reusable.process.patterns"
+ index="1"
+ name="Modelling of reusable process patterns">
+ <Description>
+ Description body text
+ </Description>
+ </Activity>
+ <Activity
+ class="org.eclipse.opencert.infra.dashboard.pages.adapters.OpenMappingSetDialogHyperLinkAdapter"
+ id="org.eclipse.opencert.infra.dashboard.activity.map.equivalences.standard"
+ image="icons/standardcompliance/equivalence_mapping_icon.png"
+ index="2"
+ name="Map equivalences between standards">
+ <Description>
+ Map equivalences between standards.
+ </Description>
+ </Activity>
+ </Section>
+ </Page>
+ <Page
+ class="org.eclipse.opencert.infra.dashboard.pages.AssuranceProjectDefinitionPage"
+ id="org.eclipse.opencert.infra.dashboard.pages.assurance.project.definition.page"
+ imageOff="icons/assuranceproject/assurance_project_def_off.png"
+ imageOn="icons/assuranceproject/assurance_project_def_on.png"
+ index="2"
+ tabName="Assurance Project Definition"
+ title="Assurance Project Definition"
+ viewer="true">
+ <Description>
+ Assurance Project Definition in OpenCert
+ </Description>
+ <Predicate
+ class="org.eclipse.opencert.infra.dashboard.predicates.DashboardPredicate">
+ </Predicate>
+ <Overview
+ imageOff="icons/assuranceproject/assurance_project_def_off.png"
+ imageOn="icons/assuranceproject/assurance_project_def_on.png">
+ <Description>
+ Define a new assurance project.
+ </Description>
+ </Overview>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.create.assurance.project"
+ index="0"
+ name="Create Assurance Project">
+ <Description>
+ The Assurance Manager can maintain the lifecycle of projects by creating Assurance Projects and system design projects associated.
+ </Description>
+ <Activity
+ class="org.eclipse.opencert.infra.dashboard.pages.adapters.OpenNewAssuranceProjectWizard"
+ id="org.eclipse.opencert.infra.dashboard.activity.create.assurance.project"
+ image="icons/assuranceproject/assurance_project_icon.png"
+ index="0"
+ name="Create a new assurance project">
+ <Description>
+ Open a wizard to create a new assurance project.
+ </Description>
+ </Activity>
+ <Activity
+ class="org.eclipse.opencert.infra.dashboard.pages.adapters.OpenNewChessProjectWizard"
+ id="org.eclipse.opencert.infra.dashboard.activity.create.chess.project"
+ image="icons/assuranceproject/chess_project_icon.png"
+ index="1"
+ name="Create a system architecture design">
+ <Description>
+ Open a wizard to create a new Chess project.
+ </Description>
+ </Activity>
+ </Section>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.define.compliance.baseline"
+ index="1"
+ name="Define Compliance Baseline">
+ <Description>
+ The Assurance Manager can manage the lifecycle of projects by updating previous defined compliance plan of a project.
+ </Description>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.create.update.baseline"
+ index="0"
+ name="Create or update a baseline">
+ <Description>
+ A baseline configuration has a set of baseline models. A baseline model represents what is planned to comply with, in a specific assurance project.
+ </Description>
+ </Activity>
+ </Section>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.assurance.project.definition.reuse"
+ index="2"
+ name="Reuse">
+ <Description>
+ The Assurance Manager can reuse the assurance assets from one assurance project to another or reuse artefacts between projects according to the equivalence maps.
+ </Description>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.cross.system.reuse"
+ index="0"
+ name="Cross system reuse">
+ <Description>
+ Description body text
+ </Description>
+ </Activity>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.cross.standard.reuse"
+ index="1"
+ name="Cross standard reuse">
+ <Description>
+ Description body text
+ </Description>
+ </Activity>
+ </Section>
+ </Page>
+ <Page
+ class="org.eclipse.opencert.infra.dashboard.pages.ProcessReusabilityDefinitionPage"
+ id="org.eclipse.opencert.infra.dashboard.pages.process.reusability.definition.page"
+ imageOff="icons/processreusability/processreusability_off.png"
+ imageOn="icons/processreusability/processreusability_on.png"
+ index="3"
+ tabName="Process Reusability Definition"
+ title="Process Reusability Definition"
+ viewer="true">
+ <Description>
+ Process Reusability Definition in OpenCert
+ </Description>
+ <Predicate
+ class="org.eclipse.opencert.infra.dashboard.predicates.DashboardPredicate">
+ </Predicate>
+ <Overview
+ imageOff="icons/processreusability/processreusability_off.png"
+ imageOn="icons/processreusability/processreusability_on.png">
+ <Description>
+ Define the process reusability.
+ </Description>
+ </Overview>
+ <Section
+ expanded="true"
+ filtering="true"
+ id="org.eclipse.opencert.infra.dashboard.section.process.reusability.definition"
+ index="0"
+ name="Process Reusability Definition">
+ <Description>
+ Define the process reuseabitlity.
+ </Description>
+ <Activity
+ id="org.eclipse.opencert.infra.dashboard.activity.define.process.reuseability"
+ index="0"
+ name="Define process reuseability">
+ <Description>
+ Define the process reuseability.
+ </Description>
+ </Activity>
+ </Section>
+ </Page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerActionBinding
+ viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension
+ pattern="org.eclipse.opencert.infra.dashboard.content">
+ </actionExtension>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <actionProvider
+ class="org.eclipse.opencert.infra.dashboard.actions.DashboardActionProvider"
+ id="org.eclipse.opencert.infra.dashboard.content"
+ overrides="org.eclipse.amalgam.explorer.activity.navigator.content"
+ priority="highest">
+ <enablement>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ </or>
+ </enablement>
+ </actionProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.opencert.infra.dashboard.handlers.OpenDashboardHandler"
+ commandId="org.eclipse.opencert.infra.dashboard.commands.opendashboard">
+ <activeWhen>
+ <or>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.ui.navigator.ProjectExplorer">
+ </equals>
+ </with>
+ <with
+ variable="activePart">
+ <instanceof
+ value="org.eclipse.ui.IEditorPart">
+ </instanceof>
+ </with>
+ </or>
+ </activeWhen>
+ <!--activeWhen>
+ <with variable="activePartId">
+ <or>
+ <instanceof
+ value="org.eclipse.ui.navigator.ProjectExplorer">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.ui.IEditorPart">
+ </instanceof>
+ </or>
+ </with>
+ </activeWhen-->
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.opencert.infra.dashboard.commands.opendashboard"
+ name="Open Dashboard">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.opencert.infra.dashboard.toolbar.opendashboard">
+ <command
+ commandId="org.eclipse.opencert.infra.dashboard.commands.opendashboard"
+ disabledIcon="icons/toolbar/icon_dashboard_disabled.png"
+ icon="icons/toolbar/icon_dashboard.png"
+ id="org.eclipse.opencert.infra.dashboard.toolbar.opendashboard"
+ label="Open Dashboard">
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+</plugin>
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/DashboardActivator.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/DashboardActivator.java
new file mode 100644
index 0000000..81c76ae
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/DashboardActivator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class DashboardActivator extends AbstractUIPlugin {
+
+ /** The plug-in ID. */
+ public static final String PLUGIN_ID = "org.eclipse.opencert.infra.dashboard"; //$NON-NLS-1$
+
+ /** The shared instance. */
+ private static DashboardActivator sPlugin;
+
+ /**
+ * The default constructor.
+ */
+ public DashboardActivator() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext pContext) throws Exception {
+ super.start(pContext);
+ sPlugin = this;
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext pContext) throws Exception {
+ sPlugin = null;
+ super.stop(pContext);
+ }
+
+ /**
+ * Return the shared instance.
+ *
+ * @return the shared instance
+ */
+ public static DashboardActivator getDefault() {
+ return sPlugin;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/DashboardActionProvider.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/DashboardActionProvider.java
new file mode 100644
index 0000000..969cc97
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/DashboardActionProvider.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.actions;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonMenuConstants;
+
+/**
+ * Provider that declares actions for the Project Explorer.
+ */
+public class DashboardActionProvider extends CommonActionProvider {
+
+ /** Action used to open Dashboard. */
+ private OpenDashboardAction mOpenDashboardAction = null;
+
+ /** Action used to go to Dashboard. */
+ private GoToDashboardAction mGoToDashboardAction = null;
+
+ /**
+ * Default constructor.
+ */
+ public DashboardActionProvider() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ ISelectionProvider vSelectionProvider = getActionSite().getViewSite().getSelectionProvider();
+
+ if (mOpenDashboardAction != null) {
+ vSelectionProvider.removeSelectionChangedListener(mOpenDashboardAction);
+ mOpenDashboardAction = null;
+ }
+
+ if (mGoToDashboardAction != null) {
+ vSelectionProvider.removeSelectionChangedListener(mGoToDashboardAction);
+ mGoToDashboardAction = null;
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void fillActionBars(final IActionBars pActionBars) {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void fillContextMenu(final IMenuManager pMenu) {
+ updateActionBars();
+
+ if (mOpenDashboardAction.canAddedToMenu()) {
+ pMenu.insertBefore(ICommonMenuConstants.GROUP_NEW, mOpenDashboardAction);
+ }
+
+ if (mGoToDashboardAction.canAddedToMenu()) {
+ pMenu.insertBefore(ICommonMenuConstants.GROUP_NEW, mGoToDashboardAction);
+ }
+
+ pMenu.insertBefore(ICommonMenuConstants.GROUP_NEW, new Separator());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(final ICommonActionExtensionSite pSite) {
+ super.init(pSite);
+
+ ISelectionProvider vSelectionProvider = pSite.getViewSite().getSelectionProvider();
+ ISelection vSelection = vSelectionProvider.getSelection();
+
+ mOpenDashboardAction = new OpenDashboardAction();
+ vSelectionProvider.addSelectionChangedListener(mOpenDashboardAction);
+
+ if (!vSelection.isEmpty()) {
+ mOpenDashboardAction.selectionChanged(new SelectionChangedEvent(vSelectionProvider, vSelection));
+ }
+
+ mGoToDashboardAction = new GoToDashboardAction();
+ if (!vSelection.isEmpty()) {
+ mGoToDashboardAction.selectionChanged(new SelectionChangedEvent(vSelectionProvider, vSelection));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void updateActionBars() {
+ IStructuredSelection vSelection = (IStructuredSelection) getContext().getSelection();
+ mOpenDashboardAction.selectionChanged(vSelection);
+ mGoToDashboardAction.selectionChanged(vSelection);
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/GoToDashboardAction.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/GoToDashboardAction.java
new file mode 100644
index 0000000..4912cad
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/GoToDashboardAction.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.actions;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.helper.SessionHelper;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.opencert.infra.dashboard.DashboardActivator;
+import org.eclipse.opencert.infra.dashboard.helpers.ChessProjectVisitor;
+import org.eclipse.opencert.infra.dashboard.helpers.OpenCertExtensions;
+import org.eclipse.sirius.business.api.session.Session;
+
+/**
+ * Action to go to the Activity Explorer for the current OpenCert file (if the related session is opened).
+ *
+ * TODO: Get the opened session then add this action to the context menu.
+ */
+public class GoToDashboardAction
+ extends org.eclipse.amalgam.explorer.activity.ui.api.actions.GoToActivityExplorerAction {
+
+ /**
+ * Default constructor.
+ */
+ protected GoToDashboardAction() {
+ super();
+ }
+
+ /**
+ * Get the session from the given selection. It can be retrieved from a DI file or from an {@link IProject}.
+ *
+ * @return The session or <code>null</code> if not found
+ */
+ @Override
+ protected Session getSession() {
+ Session vSession = null;
+
+ IStructuredSelection vSelection = getStructuredSelection();
+ if (!vSelection.isEmpty()) {
+ Object vSelectedElement = vSelection.getFirstElement();
+
+ // Ensure that the given selection is a Chess DI file with an open session
+ if ((vSelectedElement instanceof IFile)
+ && OpenCertExtensions.DI_EXTENSION.equals(((IFile) vSelectedElement).getFileExtension())) {
+ vSession = SessionHelper.getSessionForDiagramFile((IFile) vSelectedElement);
+
+ } else if (vSelectedElement instanceof IProject && ((IProject) vSelectedElement).isOpen()) {
+ // If the selection is a project, search for the DI file at the first level
+ ChessProjectVisitor vVisitor = new ChessProjectVisitor();
+
+ try {
+ ((IProject) vSelectedElement).accept(vVisitor, IResource.DEPTH_ONE, IResource.NONE);
+ } catch (final CoreException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+
+ vSession = SessionHelper.getSessionForDiagramFile(vVisitor.getFirstGraphicalFile());
+ }
+ }
+
+ return vSession;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/OpenDashboardAction.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/OpenDashboardAction.java
new file mode 100644
index 0000000..b786ee6
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/actions/OpenDashboardAction.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.actions;
+
+import java.util.Objects;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.actions.OpenSessionAction;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.ActivityExplorerEditor;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.helper.SessionHelper;
+import org.eclipse.amalgam.explorer.activity.ui.api.manager.ActivityExplorerManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.opencert.infra.dashboard.DashboardActivator;
+import org.eclipse.opencert.infra.dashboard.helpers.ChessProjectVisitor;
+import org.eclipse.opencert.infra.dashboard.helpers.OpenCertExtensions;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionManager;
+
+/**
+ * Action to open the Activity Explorer for the current graphical file. This action is overridden to be able to open the
+ * activity explorer even if the related session is not opened for the corresponding graphical file.
+ */
+public class OpenDashboardAction
+ extends org.eclipse.amalgam.explorer.activity.ui.api.actions.OpenActivityExplorerAction {
+
+ /**
+ * Default constructor.
+ */
+ protected OpenDashboardAction() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to be able to display the action even if no Sirius session is
+ * currently open. Moreover, this action must be displayed if a Session is
+ * opened, but without the corresponding activity explorer. Otherwise, a "Go
+ * To Activity Explorer" action must be used instead.
+ */
+ @Override
+ public boolean canAddedToMenu() {
+ boolean vDisplayAction = false;
+
+ // Try to find an open session
+ Session vSession = getSession();
+
+ if (Objects.nonNull(vSession)) {
+ // A session is already open, check if the corresponding activity
+ // explorer editor is also open
+ ActivityExplorerEditor vActivityExplorerEditor = ActivityExplorerManager.INSTANCE
+ .getEditorFromSession(vSession);
+ vDisplayAction = Objects.isNull(vActivityExplorerEditor);
+
+ } else {
+ // If no session is currently open, check if the selection allows to
+ // find a graphical representation file
+ vDisplayAction = Objects.nonNull(findGraphicalFileFromSelection());
+ }
+
+ return vDisplayAction;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to enable the action as soon as a graphical file can be found
+ * from the selection.
+ */
+ @Override
+ protected boolean updateSelection(final IStructuredSelection pSelection) {
+ return Objects.nonNull(findGraphicalFileFromSelection());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * It can be retrieved from an aird file or from an {@link IProject}.
+ *
+ * NB: This must search an already open session to preserve the standard
+ * behaviour of this method, and never create a session automatically here.
+ *
+ * @return The session or <code>null</code> if not found
+ */
+ @Override
+ protected Session getSession() {
+ Session vSession = null;
+
+ // Try to find the graphical file corresponding to the selection
+ IFile vSelectedGraphicalFile = findGraphicalFileFromSelection();
+
+ if (Objects.nonNull(vSelectedGraphicalFile)) {
+ // Search for an open session
+ vSession = SessionHelper.getSessionForDiagramFile(vSelectedGraphicalFile);
+ }
+
+ return vSession;
+ }
+
+ /**
+ * Find the graphical file related to the current selection. It can be the
+ * selected element directly, or the graphical file contained in a selected
+ * project.
+ *
+ * @return The graphical file found
+ */
+ private IFile findGraphicalFileFromSelection() {
+ IFile vGraphicalFile = null;
+
+ IStructuredSelection vSelection = getStructuredSelection();
+ if (!vSelection.isEmpty()) {
+ Object vSelectedElement = vSelection.getFirstElement();
+
+ // If the given selection is a local resource, it should belonged to CHESS project
+ if (vSelectedElement instanceof IResource) {
+ // If the given selection is a DI graphical file directly
+ if (vSelectedElement instanceof IFile
+ && OpenCertExtensions.DI_EXTENSION.equals(((IFile) vSelectedElement).getFileExtension())) {
+ vGraphicalFile = (IFile) vSelectedElement;
+
+ } else if (vSelectedElement instanceof IProject && ((IProject) vSelectedElement).isOpen()) {
+ // If the selection is a project, search for the graphical file DI at the first level
+ ChessProjectVisitor vVisitor = new ChessProjectVisitor();
+
+ try {
+ ((IProject) vSelectedElement).accept(vVisitor, IResource.DEPTH_ONE, IResource.NONE);
+ } catch (final CoreException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+
+ vGraphicalFile = vVisitor.getFirstGraphicalFile();
+ }
+ } else if (vSelectedElement instanceof CDOResource) {
+ // Otherwise, it should belonged to OpenCert project in the CDO Repository
+
+ // TODO: Get the graphical file from the current CDO project
+ }
+ }
+
+ return vGraphicalFile;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to be able to create a new session if none is open, and then
+ * display the activity explorer.
+ */
+ @Override
+ public void run() {
+ // First try to find an open session
+ Session vSession = getSession();
+
+ // If no session is found, try to create a new one
+ if (Objects.isNull(vSession)) {
+ IFile vSelectedGraphicalFile = findGraphicalFileFromSelection();
+
+ if (Objects.nonNull(vSelectedGraphicalFile)) {
+ URI vGraphicalFileURI = URI.createPlatformResourceURI(vSelectedGraphicalFile.getFullPath().toOSString(),
+ true);
+
+ vSession = SessionManager.INSTANCE.openSession(vGraphicalFileURI, new NullProgressMonitor(), null);
+ }
+ }
+
+ if (Objects.nonNull(vSession)) {
+ OpenSessionAction.openActivityExplorer(vSession);
+ }
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/dialogs/DashboardMappingSetDialog.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/dialogs/DashboardMappingSetDialog.java
new file mode 100644
index 0000000..9790dfd
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/dialogs/DashboardMappingSetDialog.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.dialogs;
+
+import java.util.Iterator;
+import java.util.Objects;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.opencert.infra.mappings.mapping.MapGroup;
+import org.eclipse.opencert.pkm.refframework.refframework.RefActivity;
+import org.eclipse.opencert.pkm.refframework.refframework.RefArtefact;
+import org.eclipse.opencert.pkm.refframework.refframework.RefEquivalenceMap;
+import org.eclipse.opencert.pkm.refframework.refframework.RefFramework;
+import org.eclipse.opencert.pkm.refframework.refframework.RefRequirement;
+import org.eclipse.opencert.pkm.refframework.refframework.RefRole;
+import org.eclipse.opencert.pkm.refframework.refframework.RefTechnique;
+import org.eclipse.opencert.pkm.refframework.refframework.utils.MappingSet;
+import org.eclipse.opencert.pkm.refframework.refframework.utils.TreeViewerExt;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A custom {@link MappingSet} dialog to use for the dashboard.
+ */
+public class DashboardMappingSetDialog extends MappingSet {
+
+ protected Combo mComboSource = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param pParentShell The parent shell
+ */
+ public DashboardMappingSetDialog(Shell pParentShell) {
+ super(pParentShell);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to create a custom from dialog area with:
+ * <ul>
+ * <li>a combo box to select the source refframework</li>
+ * <li>a tree viewer to show its content</li>
+ * </ul>
+ */
+ @Override
+ protected void createFromDialogArea(final Composite pParent, ComposedAdapterFactory pAdapterFactory) {
+
+ sourceComposite = new Composite(pParent, SWT.NONE);
+ GridData vGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ sourceComposite.setLayoutData(vGridData);
+ GridLayout vGridLayout = new GridLayout();
+ vGridLayout.marginHeight = 0;
+ vGridLayout.marginWidth = 0;
+ vGridLayout.numColumns = 1;
+ sourceComposite.setLayout(vGridLayout);
+
+ // Create the From label
+ sourceLabel = new Label(sourceComposite, SWT.NONE);
+ sourceLabel.setText("From");
+ GridData vSourceLabelGridData = new GridData();
+ vSourceLabelGridData.horizontalSpan = 2;
+ vSourceLabelGridData.horizontalAlignment = SWT.FILL;
+ vSourceLabelGridData.verticalAlignment = SWT.FILL;
+ sourceLabel.setLayoutData(vSourceLabelGridData);
+
+ // Create the combo box to select source refframework
+ mComboSource = new Combo(sourceComposite, SWT.READ_ONLY);
+ GridData vSourceGridData = new GridData();
+ vSourceGridData.verticalAlignment = SWT.FILL;
+ vSourceGridData.horizontalAlignment = SWT.FILL;
+ vSourceGridData.widthHint = Display.getCurrent().getBounds().width / 5;
+ vSourceGridData.heightHint = Display.getCurrent().getBounds().height / 5;
+ vSourceGridData.grabExcessHorizontalSpace = true;
+ vSourceGridData.grabExcessVerticalSpace = false;
+ mComboSource.setLayoutData(vSourceGridData);
+
+ CDOResourceNode[] vNodesArray = mCDOView.getElements();
+ for (int i = 0; i < vNodesArray.length; i++) {
+ if (vNodesArray[i] instanceof CDOResourceFolder) {
+ checkFolderContentsREF((CDOResourceFolder) vNodesArray[i], REFFRAMEWORK);
+ } else if (vNodesArray[i].getName().endsWith(REFFRAMEWORK)) {
+ refListDirRef.add(vNodesArray[i].getPath());
+ }
+ }
+
+ // Add the refframework's name to the combo
+ Iterator<String> vIterRefframework = refListDirRef.iterator();
+ while (vIterRefframework.hasNext()) {
+ mComboSource.add(vIterRefframework.next().toString());
+ }
+
+ mComboSource.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent pEvent) {
+ if (cbMapGroup.getSelectionIndex() != -1) {
+ sourceComposite.setEnabled(true);
+ }
+ resourceFrom = mCDOTransaction.getResource(refListDirRef.get(mComboSource.getSelectionIndex()));
+ createModelFromCDOResource(modelViewerSource, resourceFrom);
+ modelViewerSource.expandAll();
+
+ createModelSourceAll(modelViewerSourceAll, resourceFrom);
+ modelViewerSourceAll.expandAll();
+ }
+ });
+
+ // Create a tree viewer to display the source refframework
+ modelViewerSource = new TreeViewerExt(sourceComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+
+ GridData modelViewerGridData = new GridData();
+ modelViewerGridData.verticalAlignment = SWT.FILL;
+ modelViewerGridData.horizontalAlignment = SWT.FILL;
+ modelViewerGridData.widthHint = Display.getCurrent().getBounds().width / 3;
+ modelViewerGridData.heightHint = Display.getCurrent().getBounds().height / 3;
+ modelViewerGridData.grabExcessHorizontalSpace = true;
+ modelViewerGridData.grabExcessVerticalSpace = true;
+
+ modelViewerSource.getTree().setLayoutData(modelViewerGridData);
+ modelViewerSource.setContentProvider(new AdapterFactoryContentProvider(pAdapterFactory));
+ modelViewerSource.setLabelProvider(new AdapterFactoryLabelProvider(pAdapterFactory));
+
+ bElementTreeSelected = false;
+
+ modelViewerSource.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent pEvent) {
+
+ cbEquivalenceMap.removeAll();
+ txtJustification.setText("");
+ idText.setText("");
+ nameText.setText("");
+ cbType.select(0);
+
+ bElementTreeSelected = true;
+ bNewEquivalenceMap = false;
+
+ modelViewerTarget.expandAll();
+ modelViewerTarget.setAllChecked(false);
+
+ modelViewerSourceAll.setAllChecked(false);
+
+ object = null;
+
+ if (pEvent.getSelection() instanceof IStructuredSelection) {
+
+ IStructuredSelection sel = (IStructuredSelection) pEvent.getSelection();
+ object = (EObject) sel.getFirstElement();
+
+ if (object instanceof RefFramework || object instanceof RefEquivalenceMap) {
+ bElementTreeSelected = false;
+ return;
+ }
+
+ if (sElementFilter.contentEquals("Requirement")) {
+ if (object instanceof RefActivity) {
+ MessageDialog.openError(getShell(), "Equivalence Map",
+ "It's neccessary to select a requirement, not an activity.");
+ return;
+ }
+ }
+
+ if (object instanceof EObject) {
+ // Verify selection mapgroup and cbtarget
+ mapGroup = null;
+ if ((cbMapGroup.getSelectionIndex() == -1) || (cbTarget.getSelectionIndex() == -1)) {
+ MessageDialog.openError(getShell(), "Map Group",
+ "It's neccessary to select a map group and a target reference framework.");
+
+ } else {
+ // mapGroup is selected
+ mapGroup = lstMapGroup.get(cbMapGroup.getSelectionIndex());
+
+ // Reset the list Equivalence Map of the selected element tree
+ lstrefEquiMapFrom = null;
+
+ sElementFilter = cbFilterElementMap.getItem(cbFilterElementMap.getSelectionIndex());
+
+ // Object is the assurableElement selected from the source Tree
+ if (sElementFilter.contentEquals("Activity")) {
+ RefActivity vRefActFrom = (RefActivity) object;
+ lstrefEquiMapFrom = vRefActFrom.getEquivalence();
+ } else if (sElementFilter.contentEquals("Artefact")) {
+ RefArtefact vRefArtefactFrom = (RefArtefact) object;
+ lstrefEquiMapFrom = vRefArtefactFrom.getEquivalence();
+ } else if (sElementFilter.contentEquals("Requirement")) {
+ RefRequirement vRefReqFrom = (RefRequirement) object;
+ lstrefEquiMapFrom = vRefReqFrom.getEquivalence();
+ } else if (sElementFilter.contentEquals("Role")) {
+ RefRole vRefRoleFrom = (RefRole) object;
+ lstrefEquiMapFrom = vRefRoleFrom.getEquivalence();
+ } else {
+ RefTechnique vRefTechniqueFrom = (RefTechnique) object;
+ lstrefEquiMapFrom = vRefTechniqueFrom.getEquivalence();
+ }
+
+ lstEquivalenceMap.clear();
+ if (Objects.isNull(lstrefEquiMapFrom) || lstrefEquiMapFrom.isEmpty()) {
+ bNewEquivalenceMap = true;
+ } else {
+ Iterator<RefEquivalenceMap> vIterEquipMap = lstrefEquiMapFrom.iterator();
+ bEqualMapGroup = false;
+ boolean vIsFirst = true;
+ while (vIterEquipMap.hasNext()) {
+ final RefEquivalenceMap vRefEquiMapFrom = (RefEquivalenceMap) vIterEquipMap.next();
+
+ if (vRefEquiMapFrom.getMapGroup() != null) {
+ MapGroup vMapGroupFrom = vRefEquiMapFrom.getMapGroup();
+ if (CDOUtil.getCDOObject(vMapGroupFrom).cdoID()
+ .equals(CDOUtil.getCDOObject(mapGroup).cdoID())) {
+ bEqualMapGroup = true;
+
+ lstEquivalenceMap.add(vRefEquiMapFrom);
+ cbEquivalenceMap.add(vRefEquiMapFrom.getName());
+ if (vIsFirst) {
+ cbEquivalenceMap.select(0);
+ vIsFirst = false;
+ cbEquivalenceMap.notifyListeners(SWT.Selection, new Event());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertNewWizardIDs.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertNewWizardIDs.java
new file mode 100644
index 0000000..6a63579
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertNewWizardIDs.java
@@ -0,0 +1,19 @@
+package org.eclipse.opencert.infra.dashboard.extensionregistry;
+
+/**
+ * Class contains common wizard IDs.
+ */
+public final class OpenCertNewWizardIDs {
+
+ /** ID for dawn refframework new wizard. */
+ public static final String DAWN_REFFRAMEWORK_NEW_WIZARD_ID = "org.eclipse.opencert.pkm.refframework.refframework.diagram.part.DawnRefframeworkCreationWizard"; //$NON-NLS-1$
+
+ /** ID for method library new wizard. */
+ public static final String METHOD_LIBRARY_NEW_WIZARD_ID = "org.eclipse.epf.authoring.ui.wizards.NewLibraryWizard"; //$NON-NLS-1$
+
+ /** ID for assurance project new wizard. */
+ public static final String ASSURANCE_PROJECT_NEW_WIZARD_ID = "org.eclipse.opencert.apm.assurproj.wizards.NewAssurProjWizard"; //$NON-NLS-1$
+
+ /** ID for CHESS project new wizard. */
+ public static final String CHESS_PROJECT_NEW_WIZARD_ID = "it.unipd.chess.wizards.createproject"; //$NON-NLS-1$
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertWizardsRegistry.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertWizardsRegistry.java
new file mode 100644
index 0000000..cda662f
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/extensionregistry/OpenCertWizardsRegistry.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.extensionregistry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.opencert.infra.dashboard.DashboardActivator;
+import org.eclipse.ui.INewWizard;
+
+/**
+ * Registry for new wizard extension point.
+ */
+public final class OpenCertWizardsRegistry {
+
+ /** Registry Singleton. */
+ private static final OpenCertWizardsRegistry SINGLETON_REGISTRY = new OpenCertWizardsRegistry();
+
+ /** ID for new wizard extension point. */
+ private static final String NEW_WIZARD_EXTENSION_POINT_ID = "org.eclipse.ui.newWizards"; //$NON-NLS-1$
+
+ /** Name of wizard class element. */
+ private static final String WIZARD_CLASS_ELEMENT_NAME = "class"; //$NON-NLS-1$
+
+ /** Name of wizard id element. */
+ private static final String WIZARD_ID_ELEMENT_NAME = "id"; //$NON-NLS-1$
+
+ /** The dawn refframework new wizard. */
+ private INewWizard mDawnRefframeworkNewWizard = null;
+
+ /** The method library new wizard. */
+ private INewWizard mMethodLibraryNewWizard = null;
+
+ /** The assurance project new wizard. */
+ private INewWizard mAssuranceProjectNewWizard = null;
+
+ /** The CHESS project new wizard. */
+ private INewWizard mChessProjectNewWizard = null;
+
+ /**
+ * Does not allow to instantiate this class.
+ */
+ private OpenCertWizardsRegistry() {
+ initialiseNewWizards();
+ }
+
+ /**
+ * @return Registry instance singleton
+ */
+ public static OpenCertWizardsRegistry getInstance() {
+ return SINGLETON_REGISTRY;
+ }
+
+ /**
+ * @return The registered dawn refframework new wizard or <code>null</code> if not found
+ */
+ public INewWizard getDawnRefframeworkNewWizard() {
+ return mDawnRefframeworkNewWizard;
+ }
+
+ /**
+ * @return The registered method library new wizard or <code>null</code> if not found
+ */
+ public INewWizard getMethodLibraryNewWizard() {
+ return mMethodLibraryNewWizard;
+ }
+
+ /**
+ * @return The registered assurance project new wizard or <code>null</code> if not found
+ */
+ public INewWizard getAssuranceProjectNewWizard() {
+ return mAssuranceProjectNewWizard;
+ }
+
+ /**
+ * @return The registered Chess project new wizard or <code>null</code> if not found
+ */
+ public INewWizard getChessProjectNewWizard() {
+ return mChessProjectNewWizard;
+ }
+
+ /**
+ * Initialise all registered new wizards.
+ */
+ private void initialiseNewWizards() {
+
+ // Get registry
+ IExtensionRegistry vExtensionRegistry = Platform.getExtensionRegistry();
+
+ // Get extension point with the newWizards ID
+ for (IConfigurationElement vConfigElement : vExtensionRegistry.getExtensionPoint(NEW_WIZARD_EXTENSION_POINT_ID)
+ .getConfigurationElements()) {
+
+ String vWizardIdAttribute = vConfigElement.getAttribute(WIZARD_ID_ELEMENT_NAME);
+
+ // Flag to check if the configuration corresponds to the relevant new wizard
+ boolean vIsRefframeWorkNewWizard = vWizardIdAttribute
+ .matches(OpenCertNewWizardIDs.DAWN_REFFRAMEWORK_NEW_WIZARD_ID);
+ boolean vIsMethodLibNewWizard = vWizardIdAttribute
+ .matches(OpenCertNewWizardIDs.METHOD_LIBRARY_NEW_WIZARD_ID);
+ boolean vIsAssuranceProjectNewWizard = vWizardIdAttribute
+ .matches(OpenCertNewWizardIDs.ASSURANCE_PROJECT_NEW_WIZARD_ID);
+ boolean vIsChessProjectNewWizard = vWizardIdAttribute
+ .matches(OpenCertNewWizardIDs.CHESS_PROJECT_NEW_WIZARD_ID);
+
+ boolean vToCreateWizard = vIsRefframeWorkNewWizard || vIsMethodLibNewWizard || vIsAssuranceProjectNewWizard
+ || vIsChessProjectNewWizard;
+
+ if (vToCreateWizard) {
+ try {
+ // Instantiate it
+ INewWizard vNewWizard = (INewWizard) vConfigElement
+ .createExecutableExtension(WIZARD_CLASS_ELEMENT_NAME);
+
+ // Remember it
+ if (vIsRefframeWorkNewWizard) {
+ mDawnRefframeworkNewWizard = vNewWizard;
+ } else if (vIsMethodLibNewWizard) {
+ mMethodLibraryNewWizard = vNewWizard;
+ } else if (vIsAssuranceProjectNewWizard) {
+ mAssuranceProjectNewWizard = vNewWizard;
+ } else if (vIsChessProjectNewWizard) {
+ mChessProjectNewWizard = vNewWizard;
+ }
+ } catch (final CoreException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/handlers/OpenDashboardHandler.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/handlers/OpenDashboardHandler.java
new file mode 100644
index 0000000..072910e
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/handlers/OpenDashboardHandler.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.handlers;
+
+import java.util.Objects;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.actions.OpenSessionAction;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.ActivityExplorerEditor;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.input.ActivityExplorerEditorInput;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.opencert.infra.dashboard.DashboardActivator;
+import org.eclipse.opencert.infra.dashboard.helpers.ChessProjectVisitor;
+import org.eclipse.opencert.infra.dashboard.helpers.OpenCertExtensions;
+import org.eclipse.opencert.infra.dashboard.helpers.SelectedFilesHelper;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionManager;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Concrete implementation for command part in Command pattern. Open the
+ * dashboard for the current active project.
+ */
+public final class OpenDashboardHandler extends AbstractHandler {
+
+ /**
+ * Default constructor.
+ */
+ public OpenDashboardHandler() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object execute(final ExecutionEvent pEvent) throws ExecutionException {
+
+ // The dashboard could be opened when the current selection:
+ // - is in the Project Explorer, for a Chess project or a CDO project
+ // - is in an opened editor, then the current Chess project can be retrieved
+ // but not yet for the CDO OpenCert project
+ // Other cases should be ignored
+
+ // TODO: handle the opened diagram editor for CDO project
+
+ // Get selection, filtering with UML extension to find only CHESS projects
+ SelectedFilesHelper vSelectionFileHelper = new SelectedFilesHelper();
+ vSelectionFileHelper.setExtensionFilters(new String[] { OpenCertExtensions.UML_EXTENSION });
+ vSelectionFileHelper.initFromEvent(pEvent);
+
+ IProject vCurrentProjet = vSelectionFileHelper.getSelectedProject();
+ Session vSession = null;
+
+ // If the project could be found
+ if (Objects.nonNull(vCurrentProjet)) {
+ // Visit the project to find a graphical file and create a new session
+ ChessProjectVisitor vVisitor = new ChessProjectVisitor();
+
+ try {
+ vCurrentProjet.accept(vVisitor, IResource.DEPTH_ONE, IResource.NONE);
+ } catch (final CoreException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+
+ IFile vGraphicalFile = vVisitor.getFirstGraphicalFile();
+ if (Objects.nonNull(vGraphicalFile)) {
+ URI vGraphicalFileURI = URI.createPlatformResourceURI(vGraphicalFile.getFullPath().toOSString(), true);
+
+ // Create a new session
+ vSession = SessionManager.INSTANCE.openSession(vGraphicalFileURI, new NullProgressMonitor(), null);
+ }
+ } else {
+ // Otherwise, the selected element could be a CDOResource (for OpenCert project)
+ Object selectedObject = getFirstSelectionObject(pEvent);
+ if (selectedObject instanceof CDOResource) {
+ // TODO: handle the CDO resource
+ }
+ }
+
+ // Finally, if a session is found or created, open the corresponding activity explorer
+ if (Objects.nonNull(vSession)) {
+ OpenSessionAction.openActivityExplorer(vSession);
+ } else {
+ // Otherwise, open the dashboard for a null session
+ IWorkbenchPage vActivePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ vActivePage.openEditor(new ActivityExplorerEditorInput(null, null), ActivityExplorerEditor.ID);
+ } catch (PartInitException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the first selection object from an execution event.
+ *
+ * @param pEvent
+ * The execution event
+ * @return The first selected object
+ */
+ private Object getFirstSelectionObject(final ExecutionEvent pEvent) {
+
+ Object vFirstSelectedObject = null;
+
+ IWorkbenchWindow vWorkenchWindow = HandlerUtil.getActiveWorkbenchWindow(pEvent);
+
+ if (Objects.nonNull(vWorkenchWindow)) {
+ ISelection vCurrentSelection = vWorkenchWindow.getSelectionService().getSelection();
+
+ if (vCurrentSelection instanceof ITreeSelection) {
+ vFirstSelectedObject = ((ITreeSelection) vCurrentSelection).getFirstElement();
+ }
+ }
+
+ return vFirstSelectedObject;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ChessProjectVisitor.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ChessProjectVisitor.java
new file mode 100644
index 0000000..5f875e1
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ChessProjectVisitor.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.ECollections;
+
+/**
+ * Implemented resource visitor to get files for a Chess project.
+ */
+public class ChessProjectVisitor implements IResourceVisitor {
+
+ /** UML files found in Chess project. */
+ private List<IFile> mUmlFiles = new ArrayList<>();
+
+ /** Graphical files. */
+ private List<IFile> mGraphicalFiles = new ArrayList<>();
+
+ /** Notation files. */
+ private List<IFile> mNotationFiles = new ArrayList<>();
+
+ /**
+ * <code>true</code> if only one file of each type is searched,
+ * <code>false</code> otherwise.
+ */
+ private boolean mSingleFileSearch = false;
+
+ /**
+ * Constructor for a visitor only searching one file of each type.
+ */
+ public ChessProjectVisitor() {
+ this(true);
+ }
+
+ /**
+ * Default constructor.
+ *
+ * @param pSingleFile
+ * <code>true</code> if only one file of each type is searched,
+ * <code>false</code> otherwise
+ */
+ public ChessProjectVisitor(final boolean pSingleFile) {
+ mSingleFileSearch = pSingleFile;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean visit(final IResource pResource) throws CoreException {
+ boolean vContinue = checkContinue();
+
+ if (vContinue && pResource instanceof IFile) {
+ IFile file = (IFile) pResource;
+
+ switch (file.getFileExtension()) {
+ case OpenCertExtensions.UML_EXTENSION:
+ mUmlFiles.add(file);
+ break;
+
+ case OpenCertExtensions.NOTATION_EXTENSION:
+ mNotationFiles.add(file);
+ break;
+
+ case OpenCertExtensions.DI_EXTENSION:
+ mGraphicalFiles.add(file);
+ break;
+
+ default:
+ break;
+ }
+
+ vContinue = checkContinue();
+ }
+
+ return vContinue;
+ }
+
+ /**
+ * Check condition for continuing visit.
+ *
+ * @return <code>false</code> if all files are found, <code>true</code>
+ * otherwise
+ */
+ private boolean checkContinue() {
+ boolean vContinue = !mSingleFileSearch;
+ vContinue = vContinue || mUmlFiles.isEmpty();
+ vContinue = vContinue || mNotationFiles.isEmpty();
+ vContinue = vContinue || mGraphicalFiles.isEmpty();
+
+ return vContinue;
+ }
+
+ /**
+ * @return List of UML files found in project
+ */
+ public List<IFile> getUMLFiles() {
+ return ECollections.unmodifiableEList(mUmlFiles);
+ }
+
+ /**
+ * @return List of graphical files found in project
+ */
+ public List<IFile> getGraphicalFiles() {
+ return Collections.unmodifiableList(mGraphicalFiles);
+ }
+
+ /**
+ * @return List of notation files found in project
+ */
+ public List<IFile> getNotationFiles() {
+ return Collections.unmodifiableList(mNotationFiles);
+ }
+
+ /**
+ * @return First found UML file in project or <code>null</code> if no UML file is found
+ */
+ public IFile getFirstUMLFile() {
+ IFile vUmlFile = null;
+
+ if (!mUmlFiles.isEmpty()) {
+ vUmlFile = mUmlFiles.get(0);
+ }
+
+ return vUmlFile;
+ }
+
+ /**
+ * @return First graphical file find in project or <code>null</code> if no
+ * graphical file is found
+ */
+ public IFile getFirstGraphicalFile() {
+ IFile vGraphicalFile = null;
+
+ if (!mGraphicalFiles.isEmpty()) {
+ vGraphicalFile = mGraphicalFiles.get(0);
+ }
+
+ return vGraphicalFile;
+ }
+
+ /**
+ * @return First notation file in project or <code>null</code> if no notation file is found
+ */
+ public IFile getFirstNotationFile() {
+ IFile vNotationFile = null;
+
+ if (!mNotationFiles.isEmpty()) {
+ vNotationFile = mNotationFiles.get(0);
+ }
+
+ return vNotationFile;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/EclipseHelper.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/EclipseHelper.java
new file mode 100644
index 0000000..860db70
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/EclipseHelper.java
@@ -0,0 +1,141 @@
+/**
+ * [2012,2018] - ALL4TEC COPYRIGHT
+ *
+ * CONFIDENTIAL, All Rights Reserved
+ */
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import java.util.Objects;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Utility class used to provide methods to work on the Eclipse workbench easily.
+ */
+public final class EclipseHelper {
+
+ /**
+ * Default constructor.
+ */
+ private EclipseHelper() {
+ super();
+ }
+
+ /**
+ * Return the current active workbench window, or if none is active, the first workbench window known by eclipse.
+ *
+ * @return The current workbench window
+ */
+ public static IWorkbenchWindow getWorkbenchWindow() {
+ IWorkbench vWorkbench = PlatformUI.getWorkbench();
+
+ IWorkbenchWindow vCurrentWorkbenchWindow = vWorkbench.getActiveWorkbenchWindow();
+
+ // If current workbench window is null, get the first workbench of eclipse to used it
+ if (Objects.isNull(vCurrentWorkbenchWindow)) {
+ IWorkbenchWindow[] vWorkbenchWindows = vWorkbench.getWorkbenchWindows();
+ if (ArrayUtils.isNotEmpty(vWorkbenchWindows)) {
+ vCurrentWorkbenchWindow = vWorkbenchWindows[0];
+ }
+ }
+
+ return vCurrentWorkbenchWindow;
+ }
+
+ /**
+ * Get the active workbench page.
+ *
+ * @return The current active page, or <code>null</code>
+ */
+ public static IWorkbenchPage getActiveWorkbenchPage() {
+ IWorkbenchPage vWorkbenchPage = null;
+
+ IWorkbenchWindow vCurrentWorkbenchWindow = getWorkbenchWindow();
+
+ if (Objects.nonNull(vCurrentWorkbenchWindow)) {
+ vWorkbenchPage = vCurrentWorkbenchWindow.getActivePage();
+ }
+
+ return vWorkbenchPage;
+ }
+
+ /**
+ * Get the current active editor.
+ *
+ * @return The current editor, or <code>null</code> if none is open
+ */
+ public static IEditorPart getActiveEditor() {
+ IEditorPart vActiveEditorPart = null;
+
+ IWorkbenchPage vWorkbenchPage = getActiveWorkbenchPage();
+
+ if (Objects.nonNull(vWorkbenchPage)) {
+ vActiveEditorPart = vWorkbenchPage.getActiveEditor();
+ }
+
+ return vActiveEditorPart;
+ }
+
+ /**
+ * Get the current active part.
+ *
+ * @return The current part, or <code>null</code> if none is open
+ */
+ public static IWorkbenchPart getActivePart() {
+ IWorkbenchPart vActivePart = null;
+
+ IWorkbenchPage vWorkbenchPage = getActiveWorkbenchPage();
+
+ if (Objects.nonNull(vWorkbenchPage)) {
+ vActivePart = vWorkbenchPage.getActivePart();
+ }
+
+ return vActivePart;
+ }
+
+ /**
+ * Get the current active part site.
+ *
+ * @return The current part site, or <code>null</code> if none is open
+ */
+ public static IWorkbenchPartSite getActivePartSite() {
+ IWorkbenchPartSite vActivePart = null;
+
+ IWorkbenchPart vWorkbenchPart = getActivePart();
+
+ if (Objects.nonNull(vWorkbenchPart)) {
+ vActivePart = vWorkbenchPart.getSite();
+ }
+
+ return vActivePart;
+ }
+
+ /**
+ * Get {@link Shell} from active workbench or create a new.
+ *
+ * @return {@link Shell} of active workbench if it is possible, otherwise a new one
+ */
+ public static Shell getActiveShell() {
+ Shell vActiveShell = new Shell();
+
+ // Check if workbench is running
+ if (PlatformUI.isWorkbenchRunning()) {
+ IWorkbenchWindow vWorkbenchWindow = getWorkbenchWindow();
+
+ // Verify if there is an active window to get its own shell
+ if (Objects.nonNull(vWorkbenchWindow)) {
+ vActiveShell = vWorkbenchWindow.getShell();
+ }
+ }
+
+ return vActiveShell;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ISelectionHelper.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ISelectionHelper.java
new file mode 100644
index 0000000..1cca761
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ISelectionHelper.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+
+/**
+ * Common interface for all the selection helper implementations. This allows to
+ * have a common initialisation mechanism, based on a given execution event, or
+ * directly from a selection.
+ */
+public interface ISelectionHelper {
+
+ /**
+ * Initialise this helper from the given event.
+ *
+ * This will explore the event source to find the related part and extract
+ * the current selection from it.
+ *
+ * @param pEvent
+ * Execution event defining the context of this helper
+ * initialisation
+ */
+ void initFromEvent(ExecutionEvent pEvent);
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/OpenCertExtensions.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/OpenCertExtensions.java
new file mode 100644
index 0000000..088dd70
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/OpenCertExtensions.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+/**
+ * Utility class that contains all the file extensions for OpenCert.
+ */
+public final class OpenCertExtensions {
+
+ /** CHESS UML file extension. */
+ public static final String UML_EXTENSION = "uml";
+
+ /** CHESS Notation file extension. */
+ public static final String NOTATION_EXTENSION = "notation";
+
+ /** CHESS di file extension. */
+ public static final String DI_EXTENSION = "di";
+
+ /** Baseline file extension. */
+ public static final String BASELINE_EXTENSION = "baseline";
+
+ /** Baseline diagram file extension. */
+ public static final String BASELINE_DIAGRAM_EXTENSION = "baseline_diagram";
+
+ /** Assurance project file extension. */
+ public static final String ASSURANCE_PROJECT_EXTENSION = "assuranceproject";
+
+ /** Mapping file extension. */
+ public static final String MAPPING_EXTENSION = "mapping";
+
+ /** Ref framework file extension. */
+ public static final String REFFRAMEWORK_EXTENSION = "refframework";
+
+ /** Ref framework diagram file extension. */
+ public static final String REFFRAMEWORK_DIAGRAM_EXTENSION = "refframework_diagram";
+
+ /** Vocabulary file extension. */
+ public static final String VOCABULARY_EXTENSION = "vocabulary";
+
+ /** Array of extensions that must be searched in the project. */
+ public static final String[] ALL_EXTENSIONS_ARRAY = { UML_EXTENSION, NOTATION_EXTENSION,
+ DI_EXTENSION, BASELINE_EXTENSION, BASELINE_DIAGRAM_EXTENSION,
+ ASSURANCE_PROJECT_EXTENSION, MAPPING_EXTENSION, REFFRAMEWORK_EXTENSION, REFFRAMEWORK_DIAGRAM_EXTENSION,
+ VOCABULARY_EXTENSION };
+
+ /** Array of graphical extensions that must be searched in the project. */
+ public static final String[] GRAPHICAL_EXTENSIONS_ARRAY = { DI_EXTENSION, BASELINE_DIAGRAM_EXTENSION,
+ REFFRAMEWORK_DIAGRAM_EXTENSION };
+
+ /**
+ * Private constructor to avoid instantiation.
+ */
+ private OpenCertExtensions() {
+ super();
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ProjectFinder.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ProjectFinder.java
new file mode 100644
index 0000000..2f36afd
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/ProjectFinder.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Class used to find a file in a project.
+ */
+public class ProjectFinder {
+
+ /** Current project for which research is done. */
+ private IProject mProject = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param pProject Context for research
+ */
+ public ProjectFinder(final IProject pProject) {
+ mProject = pProject;
+ }
+
+ /**
+ * Find first file in current project with given extension.
+ *
+ * @param pExtension Search parameter
+ * @return {@link IFile} found, <code>null</code> otherwise
+ * @throws CoreException If problem occurs during visit of project
+ */
+ public IFile findFirstFile(final String pExtension) throws CoreException {
+ IFile vResult = null;
+
+ if (mProject != null && mProject.isAccessible()) {
+ FileVisitorFinder vFinder = new FileVisitorFinder(pExtension);
+ mProject.accept(vFinder);
+
+ vResult = vFinder.getFile();
+ }
+
+ return vResult;
+ }
+
+ /**
+ * Find all files in current project with given extensions.
+ *
+ * @param pExtensions Search parameter
+ * @return {@link List} of {@link IFile} containing found files
+ * @throws CoreException If problem occurs during visit of project
+ */
+ public List<IFile> findAllFiles(final String[] pExtensions) throws CoreException {
+ List<IFile> vResultList = new ArrayList<>();
+
+ if (mProject != null && mProject.isAccessible()) {
+ AllFileVisitor vVisitor = new AllFileVisitor(pExtensions);
+ mProject.accept(vVisitor);
+
+ vResultList.addAll(vVisitor.getFiles());
+ }
+
+ return vResultList;
+ }
+
+ /**
+ * Class to visit project and find only one file.
+ */
+ private class FileVisitorFinder
+ implements IResourceVisitor {
+
+ /** Extension filter. */
+ private String mExtensionFilter = null;
+
+ /** First found file with right extension. */
+ private IFile mFirstFile = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param pExtension Filter for research
+ */
+ FileVisitorFinder(final String pExtension) {
+ mExtensionFilter = pExtension;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean visit(final IResource pResource) throws CoreException {
+ boolean vContinue = mFirstFile == null;
+
+ if (pResource.getType() == IResource.FILE && vContinue && pResource.getName().endsWith(mExtensionFilter)) {
+ mFirstFile = (IFile) pResource;
+
+ vContinue = false;
+ }
+
+ return vContinue;
+ }
+
+ /**
+ * @return The found file
+ */
+ public IFile getFile() {
+ return mFirstFile;
+ }
+ }
+
+ /**
+ * Visitor for project which find all files.
+ */
+ private class AllFileVisitor
+ implements IResourceVisitor {
+
+ /** Found files in project. */
+ private List<IFile> mFilesList = null;
+
+ /** Extension filter. */
+ private List<String> mExtensionFilesList = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param pFileExtensions Filter for research
+ */
+ AllFileVisitor(final String[] pFileExtensions) {
+ mFilesList = new ArrayList<>();
+ mExtensionFilesList = Arrays.asList(pFileExtensions);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean visit(final IResource pResource) throws CoreException {
+ // Check resource
+ if (pResource instanceof IFile
+ && (mExtensionFilesList.contains(pResource.getFileExtension()) || mExtensionFilesList.isEmpty())) {
+
+ mFilesList.add((IFile) pResource);
+ }
+
+ // Explore the whole project
+ return true;
+ }
+
+ /**
+ * @return Found files in project.
+ */
+ public List<IFile> getFiles() {
+ return mFilesList;
+ }
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedFilesHelper.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedFilesHelper.java
new file mode 100644
index 0000000..d3f6854
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedFilesHelper.java
@@ -0,0 +1,317 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.opencert.infra.dashboard.DashboardActivator;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Helper allowing to find from the current selection what is the current
+ * project and access to its content, like its files.
+ *
+ * The content can be filtered according to what is needed, for example to
+ * access to the propagation files only, etc.
+ */
+public class SelectedFilesHelper implements ISelectionHelper {
+
+ /** File filters extension. */
+ private String[] mExtensionFilters = ArrayUtils.EMPTY_STRING_ARRAY;
+
+ /** List of filtered files in root project of selection. */
+ private List<IFile> mFilteredFiles = new ArrayList<>();
+
+ /** Selected files. */
+ private IFile[] mSelectedFiles = new IFile[0];
+
+ /** Helper allowing to find the current project. */
+ private SelectedProjectHelper mSelectedProjectHelper = new SelectedProjectHelper();
+
+ /**
+ * Default constructor.
+ */
+ public SelectedFilesHelper() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initFromEvent(final ExecutionEvent pEvent) {
+ mFilteredFiles.clear();
+ List<IFile> vSelectedFiles = new ArrayList<>();
+
+ // Protect against null parameter
+ if (pEvent != null) {
+ // Initialise the helper to which the files search is delegated
+ mSelectedProjectHelper.initFromEvent(pEvent);
+
+ // Get all the files included in the project, with the right extension
+ mFilteredFiles.addAll(getFilesFromProject(mSelectedProjectHelper.getSelectedProject()));
+
+ vSelectedFiles.addAll(searchFilesFromSelection(pEvent));
+
+ if (vSelectedFiles.isEmpty()) {
+ vSelectedFiles.addAll(searchFilesFromEditor(pEvent));
+ }
+ }
+
+ mSelectedFiles = vSelectedFiles.toArray(new IFile[vSelectedFiles.size()]);
+ }
+
+ /**
+ * Search the project from the selection in the active part.
+ *
+ * @param pEvent
+ * Execution event defining the context of this helper
+ * initialisation
+ * @return The found project, or <code>null</code> if none found
+ */
+ private List<IFile> searchFilesFromSelection(final ExecutionEvent pEvent) {
+ List<IFile> vSelectedFiles = new ArrayList<>();
+
+ // Get active workbench window
+ IWorkbenchWindow vWorkenchWindow = HandlerUtil.getActiveWorkbenchWindow(pEvent);
+
+ if (vWorkenchWindow != null) {
+ // Get selection from the active part
+ ISelection vCurrentSelection = getCurrentSelection(vWorkenchWindow);
+
+ // Ensure that the selection is a tree selection, to be able to
+ // work with the path of the selected object
+ if (vCurrentSelection instanceof ITreeSelection) {
+ // Check if valid file is selected in the active part
+ vSelectedFiles.addAll(getSelectedFiles((ITreeSelection) vCurrentSelection));
+ }
+ }
+
+ return vSelectedFiles;
+ }
+
+ /**
+ * Search the project from the active editor if it is the active part.
+ *
+ * @param pEvent
+ * Execution event defining the context of this helper
+ * initialisation
+ * @return The found project, or <code>null</code> if none found
+ */
+ private List<IFile> searchFilesFromEditor(final ExecutionEvent pEvent) {
+ List<IFile> vSelectedFiles = new ArrayList<>();
+
+ // Get the active part and editor
+ IWorkbenchPart vActivePart = HandlerUtil.getActivePart(pEvent);
+ IEditorPart vActiveEditor = HandlerUtil.getActiveEditor(pEvent);
+
+ // Check if the active editor is the active part
+ if (vActivePart != null && vActivePart.equals(vActiveEditor)) {
+ // Get the editor input
+ IEditorInput vEditorInput = vActiveEditor.getEditorInput();
+
+ if (vEditorInput instanceof FileEditorInput) {
+ // Get the file used as editor input
+ IFile vFile = ((FileEditorInput) vEditorInput).getFile();
+
+ if (isValidFile(vFile)) {
+ vSelectedFiles.add(vFile);
+ }
+
+ } else if (vEditorInput instanceof URIEditorInput) {
+ // Get the URI used as editor input
+ URI vURI = ((URIEditorInput) vEditorInput).getURI();
+
+ IFile vFile = getFileFromURI(vURI);
+
+ if (isValidFile(vFile)) {
+ vSelectedFiles.add(vFile);
+ }
+ }
+ }
+
+ return vSelectedFiles;
+ }
+
+ /**
+ * Check if the file is not <code>null</code> and valid according to the
+ * extension filters.
+ *
+ * @param pFile
+ * The file to check
+ * @return <code>true</code> if the file is valid, <code>false</code>
+ * otherwise
+ */
+ private boolean isValidFile(final IFile pFile) {
+ boolean vValid = false;
+
+ if (pFile != null) {
+ vValid = ArrayUtils.isEmpty(mExtensionFilters)
+ || ArrayUtils.contains(mExtensionFilters, pFile.getFileExtension());
+ }
+
+ return vValid;
+ }
+
+ /**
+ * Check the current selection to determine if the user selected a file
+ * matching the extension. If yes, this selection is saved.
+ *
+ * @param pSelection
+ * Selection to check
+ * @return The list of correct selected files
+ */
+ private List<IFile> getSelectedFiles(final IStructuredSelection pSelection) {
+ List<IFile> vSelectedFiles = new ArrayList<>();
+
+ // Loop on the selected objects
+ for (Object vSelectedObject : pSelection.toList()) {
+
+ // Check that the current selected object is a file and cast it
+ if (vSelectedObject instanceof IFile) {
+ IFile vSelectedFile = (IFile) vSelectedObject;
+
+ // Add the file in the final list if there is no filter or if it
+ // pass it
+ if (isValidFile(vSelectedFile)) {
+ vSelectedFiles.add(vSelectedFile);
+ }
+ }
+ }
+
+ return vSelectedFiles;
+ }
+
+ /**
+ * Get current selection from active workbench window.
+ *
+ * @param pWorkbenchWindow
+ * Workbench windows from which get current selection
+ * @return Current selection
+ */
+ private ISelection getCurrentSelection(final IWorkbenchWindow pWorkbenchWindow) {
+ return pWorkbenchWindow.getSelectionService().getSelection();
+ }
+
+ /**
+ * Get the file corresponding to the given URI.
+ *
+ * @param pURI
+ * The URI
+ * @return The corresponding file, or <code>null</code> if not found
+ */
+ private IFile getFileFromURI(final URI pURI) {
+ IFile vFile = null;
+
+ if (pURI != null) {
+ URI vURI = pURI.trimFragment();
+
+ IWorkspaceRoot vRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ // Get the file in the workspace
+ if (vURI.isPlatform()) {
+ vFile = vRoot.getFile(new Path(vURI.toPlatformString(true)));
+ } else if (vURI.isFile()) {
+ vFile = vRoot.getFile(new Path(vURI.toFileString()));
+ }
+ }
+
+ return vFile;
+ }
+
+ /**
+ * Get all files according to extension filter into project.
+ *
+ * @param pProject
+ * Project which is explored
+ * @return List of files found
+ */
+ private List<IFile> getFilesFromProject(final IProject pProject) {
+ List<IFile> vProjectSAFiles = new ArrayList<>();
+
+ // Protect against null parameter and closed project
+ if (pProject != null && pProject.isAccessible()) {
+ ProjectFinder vFinder = new ProjectFinder(pProject);
+
+ try {
+ vProjectSAFiles.addAll(vFinder.findAllFiles(mExtensionFilters));
+ } catch (final CoreException pException) {
+ DashboardActivator.getDefault().getLog().log(pException.getStatus());
+ }
+ }
+
+ return vProjectSAFiles;
+ }
+
+ /**
+ * @return All files from root project selection according to extension
+ * filter
+ */
+ public List<IFile> getFilteredFiles() {
+ return mFilteredFiles;
+ }
+
+ /**
+ * Get the files under selection.
+ *
+ * @return Files under selection, otherwise an empty array
+ */
+ public IFile[] getSelectedFiles() {
+ return mSelectedFiles;
+ }
+
+ /**
+ * @param pExtensionFilters
+ * Extension filters for selection
+ */
+ public void setExtensionFilters(final String[] pExtensionFilters) {
+ mExtensionFilters = pExtensionFilters;
+ }
+
+ /**
+ * @return The extension filters
+ */
+ public String[] getExtensionFilters() {
+ return mExtensionFilters;
+ }
+
+ /**
+ * Return the selected project found from the current selection. This search
+ * is delegated to a specific helper.
+ *
+ * @return The selected project found, or <code>null</code> otherwise
+ */
+ public IProject getSelectedProject() {
+ return mSelectedProjectHelper.getSelectedProject();
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedProjectHelper.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedProjectHelper.java
new file mode 100644
index 0000000..9969be7
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/helpers/SelectedProjectHelper.java
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.helpers;
+
+import java.util.Objects;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Basic helper used to find the current project from the current selection in
+ * the active part.
+ */
+public class SelectedProjectHelper implements ISelectionHelper {
+
+ /** Current project. */
+ private IProject mSelectedProject = null;
+
+ /**
+ * Default constructor.
+ */
+ public SelectedProjectHelper() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * This will find the current project from the event given in parameter.
+ */
+ @Override
+ public void initFromEvent(final ExecutionEvent pEvent) {
+ mSelectedProject = null;
+
+ // Protect against null parameter
+ if (Objects.nonNull(pEvent)) {
+ // Search the project from the selection
+ mSelectedProject = searchProjectFromSelection(pEvent);
+
+ if (Objects.isNull(mSelectedProject)) {
+ // Otherwise, search the project from the editor if it is the active part
+ mSelectedProject = searchProjectFromEditor(pEvent);
+ }
+ }
+ }
+
+ /**
+ * Search the project from the selection in the active part.
+ *
+ * @param pEvent
+ * Execution event defining the context of this helper
+ * initialisation
+ * @return The found project, or <code>null</code> if not found
+ */
+ private IProject searchProjectFromSelection(final ExecutionEvent pEvent) {
+ IProject vProject = null;
+
+ // Get active workbench window
+ IWorkbenchWindow vWorkenchWindow = HandlerUtil.getActiveWorkbenchWindow(pEvent);
+
+ if (vWorkenchWindow != null) {
+ // Get selection
+ ISelection vCurrentSelection = getCurrentSelection(vWorkenchWindow);
+
+ // Ensure that the selection is a tree selection, to be able to
+ // work with the path of the selected object
+ if (vCurrentSelection instanceof ITreeSelection) {
+ // Find the current project from the selection
+ vProject = findSelectedProject((ITreeSelection) vCurrentSelection);
+ }
+ }
+
+ return vProject;
+ }
+
+ /**
+ * Search the project from the active editor if it is the active part.
+ *
+ * @param pEvent
+ * Execution event defining the context of this helper
+ * initialisation
+ * @return The found project, or <code>null</code> if not found
+ */
+ private IProject searchProjectFromEditor(final ExecutionEvent pEvent) {
+ IProject vProject = null;
+
+ // Get the active part and editor
+ IWorkbenchPart vActivePart = HandlerUtil.getActivePart(pEvent);
+ IEditorPart vActiveEditor = HandlerUtil.getActiveEditor(pEvent);
+
+ // Check if the active editor is the active part
+ if (vActivePart != null && vActivePart.equals(vActiveEditor)) {
+ vProject = getProjectFromEditor(vActiveEditor);
+ }
+
+ return vProject;
+ }
+
+ /**
+ * Get current selection from active workbench window.
+ *
+ * @param pWorkbenchWindow
+ * Workbench window from which the current selection is get
+ * @return The current selection
+ */
+ private ISelection getCurrentSelection(final IWorkbenchWindow pWorkbenchWindow) {
+ return pWorkbenchWindow.getSelectionService().getSelection();
+ }
+
+ /**
+ * Get the current project from the given selection.
+ *
+ * @param pTreeSelection
+ * Selection from where the project is searched. Must not be
+ * <code>null</code>
+ * @return Current project in which selection is made, otherwise
+ * <code>null</code>
+ */
+ private IProject findSelectedProject(final ITreeSelection pTreeSelection) {
+ IProject vProject = null;
+
+ // Get the paths of the selected objects
+ TreePath[] vPathsArray = pTreeSelection.getPaths();
+
+ // Ensure that at least one path has been found
+ // NB : It means that at least one object is selected
+ if (vPathsArray.length > 0) {
+ // Get the path of the first selected object
+ TreePath vSelectedPath = vPathsArray[0];
+
+ int vIndex = 0;
+ Object vCurrentObject = null;
+
+ // Loop on the selected object of this tree selection until a
+ // project is found
+ // NB : In most of the case it's directly the root, but the user can
+ // show working sets
+ // as root elements, etc.
+ while (vProject == null && vIndex < vSelectedPath.getSegmentCount()) {
+ // Get the current object
+ vCurrentObject = vSelectedPath.getSegment(vIndex);
+
+ // Check if this is a resource (project or file) and get its
+ // project
+ if (vCurrentObject instanceof IResource) {
+ // Remember of the project, this will stop the loop
+ vProject = ((IResource) vCurrentObject).getProject();
+ }
+
+ vIndex++;
+ }
+ }
+
+ return vProject;
+ }
+
+ /**
+ * Return the selected project based on the current selection, if it has
+ * been found during this helper initialisation.
+ *
+ * @return The project found, or <code>null</code> otherwise
+ */
+ public IProject getSelectedProject() {
+ return mSelectedProject;
+ }
+
+ /**
+ * Get the project from the given editor, i.e. the project of the resource used as editor input.
+ *
+ * @param pEditorPart
+ * The editor part
+ * @return The found project, or <code>null</code> if not found
+ */
+ private IProject getProjectFromEditor(final IEditorPart pEditorPart) {
+ IProject vProject = null;
+
+ if (pEditorPart != null) {
+ // Get the editor input
+ IEditorInput vEditorInput = pEditorPart.getEditorInput();
+
+ if (vEditorInput instanceof IFileEditorInput) {
+ // Get the file used as editor input
+ IFile vFile = ((IFileEditorInput) vEditorInput).getFile();
+
+ if (vFile != null) {
+ vProject = vFile.getProject();
+ }
+
+ } else if (vEditorInput instanceof URIEditorInput) {
+ // Get the URI used as editor input
+ URI vURI = ((URIEditorInput) vEditorInput).getURI();
+
+ vProject = getProjectFromURI(vURI);
+ }
+ }
+
+ return vProject;
+ }
+
+ /**
+ * Get the project of the file with the given URI.
+ *
+ * @param pURI
+ * The URI
+ * @return The found project, or <code>null</code> if not found
+ */
+ private IProject getProjectFromURI(final URI pURI) {
+ IProject vProject = null;
+
+ if (pURI != null) {
+ URI vURI = pURI.trimFragment();
+
+ IFile vFile = null;
+
+ IWorkspaceRoot vRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ // Get the file in the workspace
+ if (vURI.isPlatform()) {
+ vFile = vRoot.getFile(new Path(vURI.toPlatformString(true)));
+ } else if (vURI.isFile()) {
+ vFile = vRoot.getFile(new Path(vURI.toFileString()));
+ }
+
+ // If a file has been found, get its project
+ if (vFile != null) {
+ vProject = vFile.getProject();
+ }
+ }
+
+ return vProject;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AbstractActivityPage.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AbstractActivityPage.java
new file mode 100644
index 0000000..20fe3f9
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AbstractActivityPage.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.BasicSessionActivityExplorerPage;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.viewers.AbstractActivityExplorerViewer;
+import org.eclipse.opencert.infra.dashboard.viewers.OpenCertDiagramViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * Abstract implementation for all the activity pages. This implementation
+ * allows:
+ * <ul>
+ * <li>to filter the content by viewpoint,</li>
+ * <li>to remove the unused toolbar (contains a unique unused action) of the
+ * viewer located in the right side.</li>
+ * <li>to remove the unused context menus of the viewer located in the right
+ * side.</li>
+ * </ul>
+ */
+public abstract class AbstractActivityPage extends BasicSessionActivityExplorerPage {
+
+ /** The container of the viewer located in the right side of the page. */
+ private Composite mViewerContainer = null;
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to remember the viewer container, which will be used later to
+ * hide the unused toolbar.
+ */
+ @Override
+ protected Composite createViewerContainer(final Composite pParent, final IManagedForm pManagedForm) {
+ mViewerContainer = super.createViewerContainer(pParent, pManagedForm);
+ return mViewerContainer;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to hide the unused toolbar which contains the unique Remove
+ * Section Filter action.
+ */
+ @Override
+ protected void createFormContent(final IManagedForm pManagedForm) {
+ super.createFormContent(pManagedForm);
+
+ // The section which contains the toolbar is the only child of the viewer container
+ if (mViewerContainer != null && mViewerContainer.getChildren().length == 1
+ && mViewerContainer.getChildren()[0] instanceof Section) {
+
+ Section vSection = (Section) mViewerContainer.getChildren()[0];
+
+ // The toolbar which must be hidden is the third control of the found section
+ if (vSection.getChildren().length == 3 && vSection.getChildren()[2] instanceof ToolBar) {
+ ToolBar vToolbar = (ToolBar) vSection.getChildren()[2];
+ vToolbar.setVisible(false);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to use {@link OpenCertDiagramViewer} as the viewer of this
+ * page.
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Class<? extends AbstractActivityExplorerViewer>[] addViewersTypeInPage() {
+ return new Class[] { OpenCertDiagramViewer.class };
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AssuranceProjectDefinitionPage.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AssuranceProjectDefinitionPage.java
new file mode 100644
index 0000000..c4226a6
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/AssuranceProjectDefinitionPage.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages;
+
+/**
+ * Page describing the activities related to the assurance project definition.
+ */
+public class AssuranceProjectDefinitionPage extends AbstractActivityPage {
+
+ /**
+ * Default constructor.
+ */
+ public AssuranceProjectDefinitionPage() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getHeaderTitle() {
+ return "Assurance Project Definition";
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/DashboardWorkflowPage.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/DashboardWorkflowPage.java
new file mode 100644
index 0000000..b3aa6c2
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/DashboardWorkflowPage.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.OverviewActivityExplorerPage;
+
+/**
+ * Page describing the activities workflow in Safety Architect.
+ */
+public class DashboardWorkflowPage extends OverviewActivityExplorerPage {
+
+ /**
+ * Default constructor.
+ */
+ public DashboardWorkflowPage() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getHeaderTitle() {
+ return "OpenCert General Process";
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/ProcessReusabilityDefinitionPage.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/ProcessReusabilityDefinitionPage.java
new file mode 100644
index 0000000..32f10db
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/ProcessReusabilityDefinitionPage.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages;
+
+/**
+ * Page describing the activities related to the process reusability definition.
+ */
+public class ProcessReusabilityDefinitionPage extends AbstractActivityPage {
+
+ /**
+ * Default constructor.
+ */
+ public ProcessReusabilityDefinitionPage() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getHeaderTitle() {
+ return "Process Reusability Definition";
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/StandardComplianceDefinitionPage.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/StandardComplianceDefinitionPage.java
new file mode 100644
index 0000000..cf90567
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/StandardComplianceDefinitionPage.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages;
+
+/**
+ * Page describing the activities related to the standard compliance definition.
+ */
+public class StandardComplianceDefinitionPage extends AbstractActivityPage {
+
+ /**
+ * Default constructor.
+ */
+ public StandardComplianceDefinitionPage() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getHeaderTitle() {
+ return "Standard Compliance Definition";
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenDialogHyperLinkAdapter.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenDialogHyperLinkAdapter.java
new file mode 100644
index 0000000..e0e549f
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenDialogHyperLinkAdapter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+
+/**
+ * A {@link HyperlinkAdapter} to open a dialog.
+ */
+public abstract class AbstractOpenDialogHyperLinkAdapter extends HyperlinkAdapter {
+
+ /** ID of the project explorer view. */
+ protected static final String PROJECT_EXPLORER_VIEW_ID = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+
+ /** ID of the page standard compliance definition. */
+ protected static final String STANDARD_COMPLIANCE_DEFINITION_PAGE_ID = "org.eclipse.opencert.infra.dashboard.pages.standard.compliance.definition.page"; //$NON-NLS-1$
+
+ /**
+ * Default constructor.
+ */
+ public AbstractOpenDialogHyperLinkAdapter() {
+ super();
+ }
+
+ /**
+ * Open a dialog when the link is pressed.
+ */
+ protected abstract void openDialog();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void linkActivated(final HyperlinkEvent pEvent) {
+ openDialog();
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenWizardHyperLinkAdapter.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenWizardHyperLinkAdapter.java
new file mode 100644
index 0000000..9b89c8e
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/AbstractOpenWizardHyperLinkAdapter.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.ActivityExplorerEditor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.AbstractHyperlink;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+
+/**
+ * A {@link HyperlinkAdapter} to open a wizard.
+ */
+public abstract class AbstractOpenWizardHyperLinkAdapter extends HyperlinkAdapter {
+
+ /** ID of the project explorer view. */
+ protected static final String PROJECT_EXPLORER_VIEW_ID = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+
+ /** ID of the page standard compliance definition. */
+ private static final String STANDARD_COMPLIANCE_DEFINITION_PAGE_ID = "org.eclipse.opencert.infra.dashboard.pages.standard.compliance.definition.page"; //$NON-NLS-1$
+
+ /** The error message when a wizard can not be opened. */
+ private static final String ERROR_MESSAGE = "New wizard can not be opened"; //$NON-NLS-1$
+
+ /**
+ * Default constructor.
+ */
+ public AbstractOpenWizardHyperLinkAdapter() {
+ super();
+ }
+
+ /**
+ * Open a wizard when the link is pressed.
+ *
+ * @return <code>true</code> if the wizard is opened successfully, otherwise <code>false</code>
+ */
+ protected boolean openWizard() {
+ boolean vResult = false;
+
+ // Instantiate Wizard
+ INewWizard vWizard = getWizard();
+
+ if (isCorrectWizardInstance(vWizard)) {
+ initWizard(vWizard);
+
+ WizardDialog vDialog = new WizardDialog(EclipseHelper.getActiveShell(), vWizard);
+
+ // Run it
+ boolean vIsOKButtonClicked = vDialog.open() == Window.OK;
+
+ // Refresh the page to update the diagram viewers
+ if (vIsOKButtonClicked && EclipseHelper.getActiveEditor() instanceof ActivityExplorerEditor) {
+ ActivityExplorerEditor vActExplorerEditor = (ActivityExplorerEditor) EclipseHelper.getActiveEditor();
+ vActExplorerEditor.setActivePage(STANDARD_COMPLIANCE_DEFINITION_PAGE_ID);
+ }
+
+ vResult = true;
+ }
+
+ return vResult;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void linkActivated(final HyperlinkEvent pEvent) {
+ if (!openWizard()) {
+ handleError(pEvent);
+ }
+ }
+
+ /**
+ * Handle error when opening a wizard.
+ *
+ * @param pEvent
+ * The hyperlink event
+ */
+ protected void handleError(final HyperlinkEvent pEvent) {
+ AbstractHyperlink vWidget = (AbstractHyperlink) pEvent.widget;
+ MessageDialog.openError(EclipseHelper.getActiveShell(), vWidget.getText(), ERROR_MESSAGE);
+ }
+
+ /**
+ * @return The current selection from the project explorer
+ */
+ protected IStructuredSelection getCurrentSelectionFromProjectExplorer(final String pWizardID) {
+ IWorkbenchWindow vWorkbenchWindow = EclipseHelper.getWorkbenchWindow();
+
+ // Get the current selection from the project explorer view
+ ISelection vSelection = vWorkbenchWindow.getSelectionService().getSelection(PROJECT_EXPLORER_VIEW_ID);
+ IStructuredSelection vReturnSelection = StructuredSelection.EMPTY;
+
+ IWizardDescriptor vWizardDescriptor = EclipseHelper.getWorkbenchWindow().getWorkbench().getNewWizardRegistry()
+ .findWizard(pWizardID);
+
+ if (vSelection instanceof IStructuredSelection) {
+ vReturnSelection = vWizardDescriptor.adaptedSelection((IStructuredSelection) vSelection);
+ }
+
+ return vReturnSelection;
+ }
+
+ /**
+ * @return The wizard to open
+ */
+ protected abstract INewWizard getWizard();
+
+ /**
+ * @param pWizard
+ * @return <code>true</code> if the wizard is the right instance, <code>false</code> otherwise
+ */
+ protected abstract boolean isCorrectWizardInstance(INewWizard pWizard);
+
+ /**
+ * Initialise the given wizard.
+ *
+ * @param pWizard
+ * The wizard to be initialised
+ */
+ protected abstract void initWizard(INewWizard pWizard);
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenMappingSetDialogHyperLinkAdapter.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenMappingSetDialogHyperLinkAdapter.java
new file mode 100644
index 0000000..4d22056
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenMappingSetDialogHyperLinkAdapter.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.ActivityExplorerEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.opencert.infra.dashboard.dialogs.DashboardMappingSetDialog;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.opencert.pkm.refframework.refframework.utils.MappingSet;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+
+/**
+ * A {@link HyperlinkAdapter} to open the {@link MappingSet} dialog.
+ */
+public class OpenMappingSetDialogHyperLinkAdapter extends AbstractOpenDialogHyperLinkAdapter {
+
+ /**
+ * Default constructor.
+ */
+ public OpenMappingSetDialogHyperLinkAdapter() {
+ super();
+ }
+
+ /**
+ * Open a dialog when the link is pressed.
+ */
+ @Override
+ protected void openDialog() {
+
+ DashboardMappingSetDialog vMappingSet = new DashboardMappingSetDialog(EclipseHelper.getActiveShell());
+
+ // Open the dialog
+ boolean vIsOKButtonClicked = vMappingSet.open() == Window.OK;
+
+ // Refresh the page to update the diagram viewers
+ if (vIsOKButtonClicked && EclipseHelper.getActiveEditor() instanceof ActivityExplorerEditor) {
+ ActivityExplorerEditor vActExplorerEditor = (ActivityExplorerEditor) EclipseHelper.getActiveEditor();
+ vActExplorerEditor.setActivePage(STANDARD_COMPLIANCE_DEFINITION_PAGE_ID);
+ }
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewAssuranceProjectWizard.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewAssuranceProjectWizard.java
new file mode 100644
index 0000000..ccc89f8
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewAssuranceProjectWizard.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.opencert.apm.assurproj.wizards.ui.wizards.NewAssurProjWizard;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertNewWizardIDs;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertWizardsRegistry;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+
+/**
+ * A {@link HyperlinkAdapter} to open the new assurance project wizard.
+ */
+public class OpenNewAssuranceProjectWizard extends AbstractOpenWizardHyperLinkAdapter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected INewWizard getWizard() {
+ return OpenCertWizardsRegistry.getInstance().getAssuranceProjectNewWizard();
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isCorrectWizardInstance(INewWizard pWizard) {
+ return pWizard instanceof NewAssurProjWizard;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initWizard(INewWizard pWizard) {
+ NewAssurProjWizard vNewAssuranceProjectWizard = (NewAssurProjWizard) pWizard;
+
+ // Initialise the wizard
+ vNewAssuranceProjectWizard.init(EclipseHelper.getWorkbenchWindow().getWorkbench(),
+ getCurrentSelectionFromProjectExplorer(OpenCertNewWizardIDs.ASSURANCE_PROJECT_NEW_WIZARD_ID));
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewChessProjectWizard.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewChessProjectWizard.java
new file mode 100644
index 0000000..a7f6bdc
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewChessProjectWizard.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertNewWizardIDs;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertWizardsRegistry;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.polarsys.chess.wizards.wizards.CHESSNewProjectWizard;
+
+/**
+ * A {@link HyperlinkAdapter} to open the new Chess project wizard.
+ */
+public class OpenNewChessProjectWizard extends AbstractOpenWizardHyperLinkAdapter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected INewWizard getWizard() {
+ return OpenCertWizardsRegistry.getInstance().getChessProjectNewWizard();
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isCorrectWizardInstance(INewWizard pWizard) {
+ return pWizard instanceof CHESSNewProjectWizard;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initWizard(INewWizard pWizard) {
+ CHESSNewProjectWizard vNewChessProjectWizard = (CHESSNewProjectWizard) pWizard;
+
+ // Initialise the wizard
+ vNewChessProjectWizard.init(EclipseHelper.getWorkbenchWindow().getWorkbench(),
+ getCurrentSelectionFromProjectExplorer(OpenCertNewWizardIDs.CHESS_PROJECT_NEW_WIZARD_ID));
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewMethodLibraryWizard.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewMethodLibraryWizard.java
new file mode 100644
index 0000000..f25e452
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewMethodLibraryWizard.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.epf.authoring.ui.wizards.NewLibraryWizard;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertNewWizardIDs;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertWizardsRegistry;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+
+/**
+ * A {@link HyperlinkAdapter} to open the new method library wizard.
+ */
+public class OpenNewMethodLibraryWizard extends AbstractOpenWizardHyperLinkAdapter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected INewWizard getWizard() {
+ return OpenCertWizardsRegistry.getInstance().getMethodLibraryNewWizard();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isCorrectWizardInstance(INewWizard pWizard) {
+ return pWizard instanceof NewLibraryWizard;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initWizard(INewWizard pWizard) {
+ NewLibraryWizard vNewLibWizard = (NewLibraryWizard) pWizard;
+
+ // Initialise the wizard
+ vNewLibWizard.init(EclipseHelper.getWorkbenchWindow().getWorkbench(),
+ getCurrentSelectionFromProjectExplorer(OpenCertNewWizardIDs.METHOD_LIBRARY_NEW_WIZARD_ID));
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewRefframeworkDiagramWizard.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewRefframeworkDiagramWizard.java
new file mode 100644
index 0000000..66845b6
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/pages/adapters/OpenNewRefframeworkDiagramWizard.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.pages.adapters;
+
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertNewWizardIDs;
+import org.eclipse.opencert.infra.dashboard.extensionregistry.OpenCertWizardsRegistry;
+import org.eclipse.opencert.infra.dashboard.helpers.EclipseHelper;
+import org.eclipse.opencert.pkm.refframework.refframework.diagram.part.RefframeworkCreationWizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+
+/**
+ * A {@link HyperlinkAdapter} to open the new refframework diagram wizard.
+ */
+public class OpenNewRefframeworkDiagramWizard extends AbstractOpenWizardHyperLinkAdapter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected INewWizard getWizard() {
+ return OpenCertWizardsRegistry.getInstance().getDawnRefframeworkNewWizard();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isCorrectWizardInstance(INewWizard pWizard) {
+ return pWizard instanceof RefframeworkCreationWizard;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initWizard(INewWizard pWizard) {
+ RefframeworkCreationWizard vRefframeworkCreationWizard = (RefframeworkCreationWizard) pWizard;
+
+ // Initialise the wizard
+ vRefframeworkCreationWizard.init(EclipseHelper.getWorkbenchWindow().getWorkbench(),
+ getCurrentSelectionFromProjectExplorer(OpenCertNewWizardIDs.DAWN_REFFRAMEWORK_NEW_WIZARD_ID));
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/predicates/DashboardPredicate.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/predicates/DashboardPredicate.java
new file mode 100644
index 0000000..c77e016
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/predicates/DashboardPredicate.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.predicates;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.predicates.IPredicate;
+
+/**
+ * Predicate implementation to specify when the dashboard is available.
+ */
+public class DashboardPredicate implements IPredicate {
+
+ /**
+ * Default constructor.
+ */
+ public DashboardPredicate() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOk() {
+ // TODO Validate this predicate only if the current session is linked to OpenCert resource.
+ return true;
+ }
+}
diff --git a/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/viewers/OpenCertDiagramViewer.java b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/viewers/OpenCertDiagramViewer.java
new file mode 100644
index 0000000..a9fb552
--- /dev/null
+++ b/org.eclipse.opencert.infra.dashboard/src/org/eclipse/opencert/infra/dashboard/viewers/OpenCertDiagramViewer.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2018 ALL4TEC.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.opencert.infra.dashboard.viewers;
+
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.BasicSessionActivityExplorerPage;
+import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.viewers.DiagramViewer;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * A custom diagram viewer to be used in the Dashboard. This viewer contains no
+ * context menus.
+ */
+public class OpenCertDiagramViewer extends DiagramViewer {
+
+ /**
+ * Default constructor.
+ *
+ * @param pActivityExplorerPage
+ * The activity explorer page which contains this viewer
+ */
+ public OpenCertDiagramViewer(final BasicSessionActivityExplorerPage pActivityExplorerPage) {
+ super(pActivityExplorerPage);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to delete all context menus in this viewer.
+ */
+ @Override
+ protected MenuManager initMenuToViewer(final TreeViewer pTreeViewer) {
+ return null;
+ }
+}
diff --git a/org.eclipse.opencert.pkm.refframework.diagram.dawn/src/org/eclipse/opencert/pkm/refframework/refframework/diagram/part/DawnRefframeworkCreationWizard.java b/org.eclipse.opencert.pkm.refframework.diagram.dawn/src/org/eclipse/opencert/pkm/refframework/refframework/diagram/part/DawnRefframeworkCreationWizard.java
index 59c4e5a..d76f681 100644
--- a/org.eclipse.opencert.pkm.refframework.diagram.dawn/src/org/eclipse/opencert/pkm/refframework/refframework/diagram/part/DawnRefframeworkCreationWizard.java
+++ b/org.eclipse.opencert.pkm.refframework.diagram.dawn/src/org/eclipse/opencert/pkm/refframework/refframework/diagram/part/DawnRefframeworkCreationWizard.java
@@ -17,24 +17,22 @@
*******************************************************************************/
package org.eclipse.opencert.pkm.refframework.refframework.diagram.part;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
import org.eclipse.emf.cdo.dawn.ui.wizards.DawnCreateNewDiagramResourceWizardPage;
import org.eclipse.emf.cdo.dawn.ui.wizards.DawnCreateNewResourceWizardPage;
import org.eclipse.emf.cdo.dawn.util.connection.CDOConnectionUtil;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.view.CDOView;
-
import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import java.lang.reflect.InvocationTargetException;
-
public class DawnRefframeworkCreationWizard extends RefframeworkCreationWizard {
private CDOView view;
@@ -44,12 +42,6 @@
public DawnRefframeworkCreationWizard() {
super();
- CDOConnectionUtil.instance.init(
- PreferenceConstants.getRepositoryName(),
- PreferenceConstants.getProtocol(),
- PreferenceConstants.getServerName());
- CDOSession session = CDOConnectionUtil.instance.getCurrentSession();
- view = CDOConnectionUtil.instance.openView(session);
}
@Override
@@ -97,6 +89,13 @@
@Override
public void addPages() {
+ // Create new pages only if resource wizard pages do not exist
+ if (getPageCount() > 0) {
+ return;
+ }
+
+ // The CDO view need to be initialised before creating wizard pages
+ initCDOView();
dawnDiagramModelFilePage = new DawnCreateNewDiagramResourceWizardPage(
"refframework_diagram", false, view);
@@ -135,6 +134,16 @@
addPage(dawnDomainModelFilePage);
}
+ /**
+ * Initialise the CDO view.
+ */
+ protected void initCDOView() {
+ CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(),
+ PreferenceConstants.getServerName());
+ CDOSession session = CDOConnectionUtil.instance.getCurrentSession();
+ view = CDOConnectionUtil.instance.openView(session);
+ }
+
@Override
public void dispose() {
view.close();
diff --git a/org.eclipse.opencert.pkm.refframework.edit/META-INF/MANIFEST.MF b/org.eclipse.opencert.pkm.refframework.edit/META-INF/MANIFEST.MF
index b4eb408..37768d0 100644
--- a/org.eclipse.opencert.pkm.refframework.edit/META-INF/MANIFEST.MF
+++ b/org.eclipse.opencert.pkm.refframework.edit/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.opencert.pkm.refframework.refframework.provider,
- org.eclipse.opencert.pkm.refframework.refframework.providers
+ org.eclipse.opencert.pkm.refframework.refframework.utils
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.opencert.pkm.refframework;visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport,
diff --git a/org.eclipse.opencert.pkm.refframework.edit/src/org/eclipse/opencert/pkm/refframework/refframework/utils/MappingSet.java b/org.eclipse.opencert.pkm.refframework.edit/src/org/eclipse/opencert/pkm/refframework/refframework/utils/MappingSet.java
index f91ba8d..43bb5b2 100644
--- a/org.eclipse.opencert.pkm.refframework.edit/src/org/eclipse/opencert/pkm/refframework/refframework/utils/MappingSet.java
+++ b/org.eclipse.opencert.pkm.refframework.edit/src/org/eclipse/opencert/pkm/refframework/refframework/utils/MappingSet.java
@@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.common.util.CDOException;
@@ -70,6 +71,23 @@
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.opencert.infra.mappings.mapping.MapGroup;
+import org.eclipse.opencert.infra.mappings.mapping.MapJustification;
+import org.eclipse.opencert.infra.mappings.mapping.MapKind;
+import org.eclipse.opencert.infra.mappings.mapping.MapModel;
+import org.eclipse.opencert.infra.mappings.mapping.MappingFactory;
+import org.eclipse.opencert.pkm.refframework.refframework.RefActivity;
+import org.eclipse.opencert.pkm.refframework.refframework.RefArtefact;
+import org.eclipse.opencert.pkm.refframework.refframework.RefAssurableElement;
+import org.eclipse.opencert.pkm.refframework.refframework.RefEquivalenceMap;
+import org.eclipse.opencert.pkm.refframework.refframework.RefFramework;
+import org.eclipse.opencert.pkm.refframework.refframework.RefRequirement;
+import org.eclipse.opencert.pkm.refframework.refframework.RefRole;
+import org.eclipse.opencert.pkm.refframework.refframework.RefTechnique;
+import org.eclipse.opencert.pkm.refframework.refframework.RefframeworkFactory;
+import org.eclipse.opencert.pkm.refframework.refframework.RefframeworkPackage;
+import org.eclipse.opencert.pkm.refframework.refframework.provider.RefframeworkEditPlugin;
+import org.eclipse.opencert.pkm.refframework.refframework.util.ModelStorage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -88,23 +106,6 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.opencert.infra.mappings.mapping.MapGroup;
-import org.eclipse.opencert.infra.mappings.mapping.MapJustification;
-import org.eclipse.opencert.infra.mappings.mapping.MapKind;
-import org.eclipse.opencert.infra.mappings.mapping.MapModel;
-import org.eclipse.opencert.infra.mappings.mapping.MappingFactory;
-import org.eclipse.opencert.pkm.refframework.refframework.RefActivity;
-import org.eclipse.opencert.pkm.refframework.refframework.RefArtefact;
-import org.eclipse.opencert.pkm.refframework.refframework.RefAssurableElement;
-import org.eclipse.opencert.pkm.refframework.refframework.RefEquivalenceMap;
-import org.eclipse.opencert.pkm.refframework.refframework.RefFramework;
-import org.eclipse.opencert.pkm.refframework.refframework.RefRequirement;
-import org.eclipse.opencert.pkm.refframework.refframework.RefRole;
-import org.eclipse.opencert.pkm.refframework.refframework.RefTechnique;
-import org.eclipse.opencert.pkm.refframework.refframework.RefframeworkFactory;
-import org.eclipse.opencert.pkm.refframework.refframework.RefframeworkPackage;
-import org.eclipse.opencert.pkm.refframework.refframework.provider.RefframeworkEditPlugin;
-import org.eclipse.opencert.pkm.refframework.refframework.util.ModelStorage;
public class MappingSet extends Dialog {
@@ -115,16 +116,16 @@
private static final String ClassDiagram = "org.eclipse.opencert.pkm.refframework.refframework.diagram.part.DawnRefframeworkDiagramEditor";
- private static final String REFFRAMEWORK = ".refframework";
- private static final String MAPPING = ".mapping";
+ protected static final String REFFRAMEWORK = ".refframework";
+ protected static final String MAPPING = ".mapping";
protected String qref;
- private CDOView viewCDO = null;
- private CDOTransaction transaction = null;
- private CDOSession sessionCDO = null;
+ protected CDOView mCDOView = null;
+ protected CDOTransaction mCDOTransaction = null;
+ protected CDOSession sessionCDO = null;
- private CDOResource resourceFrom = null;
+ protected CDOResource resourceFrom = null;
protected org.eclipse.swt.widgets.List refList;
protected ArrayList<String> refListDirRef;
@@ -153,25 +154,25 @@
protected Combo cbType;
- boolean nelementTreeSelected = false;
- boolean bnewEquivalenceMap = false;
- boolean bEqualMapGroup = false;
+ protected boolean bElementTreeSelected = false;
+ protected boolean bNewEquivalenceMap = false;
+ protected boolean bEqualMapGroup = false;
- Composite sourceComposite = null;
+ protected Composite sourceComposite = null;
- EObject object;
- EObject objectSourceAll;
- EObject objectTarget;
+ protected EObject object;
+ protected EObject objectSourceAll;
+ protected EObject objectTarget;
//List Equivalence Map of the selected element tree
- EList<RefEquivalenceMap> lstrefEquiMapFrom;
+ protected EList<RefEquivalenceMap> lstrefEquiMapFrom;
Map<Object, Object> options = new HashMap<Object, Object>();
- EList<RefEquivalenceMap> lstEquivalenceMap;
- EList <MapGroup> lstMapGroup;
- EList <RefActivity> lstrefActivity;
+ protected EList<RefEquivalenceMap> lstEquivalenceMap = new BasicEList<RefEquivalenceMap>();
+ protected EList<MapGroup> lstMapGroup;
+ protected EList<RefActivity> lstrefActivity;
EList <RefArtefact> lstrefArtefact;
EList <RefRequirement> lstrefRequirement;
EList <RefRole> lstrefRole;
@@ -191,7 +192,7 @@
public String MapModelPath;
protected RefEquivalenceMap refEquivalenceMap;
- String sElementFilter;
+ protected String sElementFilter;
private ReferencesTableSettings targetSettings;
@@ -223,8 +224,8 @@
PreferenceConstants.getProtocol(),
PreferenceConstants.getServerName());
sessionCDO = CDOConnectionUtil.instance.getCurrentSession();
- viewCDO = CDOConnectionUtil.instance.openView(sessionCDO);
- transaction = sessionCDO.openTransaction();
+ mCDOView = CDOConnectionUtil.instance.openView(sessionCDO);
+ mCDOTransaction = sessionCDO.openTransaction();
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX );
@@ -348,7 +349,7 @@
path = path.substring(0,path.length()-1);
try {
- resourceFrom = transaction.getResource(path);
+ resourceFrom = mCDOTransaction.getResource(path);
} catch (CDOException e) {
@@ -357,10 +358,10 @@
}
- CreateModelFromFile(modelViewerSource,resourceFrom);
+ createModelFromCDOResource(modelViewerSource, resourceFrom);
modelViewerSource.expandAll();
- nelementTreeSelected = false;
+ bElementTreeSelected = false;
modelViewerSource.addSelectionChangedListener(new ISelectionChangedListener() {
@SuppressWarnings("deprecation")
@@ -374,8 +375,8 @@
nameText.setText("");
cbType.select(0);
- nelementTreeSelected = true;
- bnewEquivalenceMap = false;
+ bElementTreeSelected = true;
+ bNewEquivalenceMap = false;
//Unselected all the elements of the target tree
modelViewerTarget.expandAll();
@@ -396,7 +397,7 @@
object = (EObject) sel.getFirstElement();
// Para descartar la selección del framework comprobamos si su container es null
if (object instanceof RefFramework || object instanceof RefEquivalenceMap) {
- nelementTreeSelected = false;
+ bElementTreeSelected = false;
return;
}
@@ -449,9 +450,9 @@
refElemtFrom = null;
}
- lstEquivalenceMap = (EList<RefEquivalenceMap>) new BasicEList<RefEquivalenceMap>();
+ lstEquivalenceMap.clear();
if (lstrefEquiMapFrom.isEmpty()) {
- bnewEquivalenceMap = true;
+ bNewEquivalenceMap = true;
// lo voy a hacer tras chequear un target, ya wue si luego no selecciona target se queda vacio el
// equivalence Map
//addEquivalenceMap(mapGroup, object);
@@ -535,7 +536,7 @@
//cbFilterElementMapGridData.heightHint = Display.getCurrent().getBounds().height / 7;
refListDirMap = new ArrayList<String>();
- CDOResourceNode[] listR= viewCDO.getElements();
+ CDOResourceNode[] listR= mCDOView.getElements();
for (int i = 0; i < listR.length; i++) {
if (listR[i] instanceof CDOResourceFolder) {
@@ -664,9 +665,9 @@
if (cbFilterElementMap.getSelectionIndex() != -1 ) {
sElementFilter = cbFilterElementMap.getItem(cbFilterElementMap.getSelectionIndex());
- CreateModelFromFile(modelViewerSource,resourceFrom);
+ createModelFromCDOResource(modelViewerSource, resourceFrom);
modelViewerSource.expandAll();
- CreateModelFromFile1(modelViewerTarget,refListDirRef.get(cbTarget.getSelectionIndex()));
+ createModelFromFilePath(modelViewerTarget, refListDirRef.get(cbTarget.getSelectionIndex()));
modelViewerTarget.expandAll();
modelViewerSourceAll.setAllChecked(false);
@@ -716,7 +717,7 @@
nameText.setText("");
cbType.select(-1);
- if ((cbTarget.getSelectionIndex() == -1) || !nelementTreeSelected) {
+ if ((cbTarget.getSelectionIndex() == -1) || !bElementTreeSelected) {
MessageDialog.openError(getShell(), "Equivalence Map","It's neccesary select a target");
} else {
refEquivalenceMap = lstEquivalenceMap.get(cbEquivalenceMap.getSelectionIndex());
@@ -732,7 +733,7 @@
Text text = (Text) event.widget;
refEquivalenceMap.setId(text.getText());
try {
- if (!bnewEquivalenceMap) {
+ if (!bNewEquivalenceMap) {
refEquivalenceMap.eResource().save(options);
}
} catch (IOException e) {
@@ -754,7 +755,7 @@
refEquivalenceMap.setName(text1.getText());
try {
- if (!bnewEquivalenceMap) {
+ if (!bNewEquivalenceMap) {
refEquivalenceMap.eResource().save(options);
}
} catch (IOException e) {
@@ -782,7 +783,7 @@
String value = combo.getItem(combo.getSelectionIndex());
refEquivalenceMap.setType(MapKind.get(value));
try {
- if (!bnewEquivalenceMap) {
+ if (!bNewEquivalenceMap) {
refEquivalenceMap.eResource().save(options);
}
} catch (IOException e) {
@@ -1038,7 +1039,7 @@
//MessageDialog.openError(getShell(),"New Compliance Map", "New Compliance Map create.");
// Reload combo compliance map
- CreateModelFromFiletocomboObject(cbEquivalenceMap,object);
+ createModelFromFileToComboObject(cbEquivalenceMap,object);
modelViewerTarget.setAllChecked(false);
txtJustification.setText("");
idText.setText("");
@@ -1178,7 +1179,7 @@
cbTargetGridData.grabExcessVerticalSpace = true;
cbTarget.setLayoutData(cbTargetGridData);
- CDOResourceNode[] listR= viewCDO.getElements();
+ CDOResourceNode[] listR= mCDOView.getElements();
for (int i = 0; i < listR.length; i++){
if (listR[i] instanceof CDOResourceFolder) {
checkFolderContentsREF((CDOResourceFolder) listR[i], REFFRAMEWORK);
@@ -1200,7 +1201,7 @@
if (cbMapGroup.getSelectionIndex() != -1) {
sourceComposite.setEnabled(true);
}
- CreateModelFromFile1(modelViewerTarget,refListDirRef.get(cbTarget.getSelectionIndex()));
+ createModelFromFilePath(modelViewerTarget, refListDirRef.get(cbTarget.getSelectionIndex()));
modelViewerTarget.expandAll();
}
});
@@ -1261,7 +1262,7 @@
if (pp) {
targetSettings.getSource().eResource().save(options);
- transaction.commit();
+ mCDOTransaction.commit();
}
} else {
boolean pp = PlatformUI.getWorkbench().saveAllEditors(true);
@@ -1339,7 +1340,7 @@
public void widgetSelected(SelectionEvent e) {
try {
PlatformUI.getWorkbench().saveAllEditors(true);
- transaction.commit();
+ mCDOTransaction.commit();
} catch (ConcurrentAccessException e1) {
e1.printStackTrace();
} catch (CommitException e1) {
@@ -1362,7 +1363,7 @@
modelViewerSourceAll.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
modelViewerSourceAll.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- CreateModelSourceAll(modelViewerSourceAll,resourceFrom);
+ createModelSourceAll(modelViewerSourceAll, resourceFrom);
modelViewerSourceAll.expandAll();
ICheckStateListener checkStateListenerSourceAll = new ICheckStateListener(){
@@ -1403,7 +1404,7 @@
boolean pp = PlatformUI.getWorkbench().saveAllEditors(true);
if (pp) {
targetSettings.getSource().eResource().save(options);
- transaction.commit();
+ mCDOTransaction.commit();
}
} else {
boolean pp = PlatformUI.getWorkbench().saveAllEditors(true);
@@ -1472,9 +1473,9 @@
}
- public void CreateModelFromFiletocomboObject(Combo combo, Object object) {
+ public void createModelFromFileToComboObject(Combo combo, Object object) {
- lstEquivalenceMap.removeAll(lstEquivalenceMap);
+ lstEquivalenceMap.clear();
cbEquivalenceMap.removeAll();
Iterator<RefEquivalenceMap> iter1 = ((RefAssurableElement)object).getEquivalence().iterator();
@@ -1512,7 +1513,7 @@
Resource resource = null;
try {
- resource = viewCDO.getResource(spath, true);
+ resource = mCDOView.getResource(spath, true);
EList<EObject> rsobject = resource.getContents();
@@ -1538,15 +1539,18 @@
/**
- * CreateModelFromFile: load the resource of the model
- * @param tviewer widget in which the model will be visualized
- * @param model string with the path and name of the model in the file system
+ * Load the resource of the model from a {@link CDOResource}.
+ *
+ * @param pTreeViewer
+ * The tree viewer in which the model will be visualized
+ * @param pCDOResource
+ * The CDO resource
*/
- public void CreateModelFromFile(TreeViewer tviewer, CDOResource resource){
+ public void createModelFromCDOResource(TreeViewer pTreeViewer, CDOResource pCDOResource) {
if (resourceURI != null) {
try {
- tviewer.setInput(null);
- tviewer.setInput(resource);
+ pTreeViewer.setInput(null);
+ pTreeViewer.setInput(pCDOResource);
final ViewerFilter modelFilter = new ViewerFilter() {
public boolean select(
Viewer viewer,
@@ -1600,22 +1604,26 @@
}
};
- tviewer.addFilter(modelFilter);
+ pTreeViewer.addFilter(modelFilter);
}
catch (Exception ex) {
MessageDialog.openError(getShell(), "Not valid model file", "The provided model file couldn't be parsed as an EMF resource");
- tviewer.setInput(null);
+ pTreeViewer.setInput(null);
}
}
}
/**
- * CreateModelSourceAll: load the resource of the model without filter
- * @param tviewer widget in which the model will be visualized
+ * Load a model from a CDO resource without filtering.
+ *
+ * @param tviewer
+ * widget in which the model will be visualized
+ * @param resource
+ * The CDO resource
*/
- public void CreateModelSourceAll(TreeViewer tviewer, CDOResource resource){
+ public void createModelSourceAll(TreeViewer tviewer, CDOResource resource){
lstrefActivitySourceAll = new BasicEList<RefActivity>();
lstrefArtefactSourceAll = new BasicEList<RefArtefact>();
@@ -1670,16 +1678,15 @@
}
}
-
-
-
-
/**
- * CreateModelFromFile: load the resource of the model
- * @param tviewer widget in which the model will be visualized
- * @param model string with the path and name of the model in the file system
+ * Load the resource of the model from a file path:
+ *
+ * @param tviewer
+ * widget in which the model will be visualized
+ * @param sModel
+ * string with the path and name of the model in the file system
*/
- public void CreateModelFromFile1(TreeViewer tviewer, String sModel){
+ public void createModelFromFilePath(TreeViewer tviewer, String sModel) {
lstrefActivity = new BasicEList<RefActivity>();
lstrefArtefact= new BasicEList<RefArtefact>();
@@ -1691,7 +1698,7 @@
Resource resource = null;
try {
- resource = viewCDO.getResource(sModel, true);
+ resource = mCDOView.getResource(sModel, true);
tviewer.setInput(null);
tviewer.setInput(resource);
final ViewerFilter modelFilter = new ViewerFilter() {
@@ -1906,21 +1913,23 @@
return permission.isReadable();
}
- private void checkFolderContents(CDOResourceFolder cdoResourceFolder, String sCadena) {
+ protected void checkFolderContents(CDOResourceFolder cdoResourceFolder, String sCadena) {
if (hasReadPermission(cdoResourceFolder)) {
EList<CDOResourceNode> listN = cdoResourceFolder.getNodes();
for (int i = 0; i < listN.size(); i++) {
if (listN.get(i) instanceof CDOResourceFolder) {
checkFolderContents((CDOResourceFolder) listN.get(i), sCadena);
} else if (listN.get(i).getName().endsWith(sCadena)) {
- refList.add(listN.get(i).getName());
+ if (Objects.nonNull(refList)) {
+ refList.add(listN.get(i).getName());
+ }
refListDirMap.add(listN.get(i).getPath());
}
}
}
}
- private void checkFolderContentsREF(CDOResourceFolder cdoResourceFolder, String sCadena) {
+ protected void checkFolderContentsREF(CDOResourceFolder cdoResourceFolder, String sCadena) {
if (hasReadPermission(cdoResourceFolder)) {
EList<CDOResourceNode> listN = cdoResourceFolder.getNodes();
for (int i = 0; i < listN.size(); i++) {