[468660] Contribution - Contextual Explorer
Bug: 468660
Change-Id: If1ad2a4ee3693cb3c1cb958c1f2831491d0a0cba
Signed-off-by: Philippe DUL <philippe.dul@thalesgroup.com>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/.project b/features/org.eclipse.amalgam.explorer.contextual.core.feature/.project
new file mode 100644
index 0000000..d46624d
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.core.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/build.properties b/features/org.eclipse.amalgam.explorer.contextual.core.feature/build.properties
new file mode 100644
index 0000000..65a44df
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/build.properties
@@ -0,0 +1,15 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+bin.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ license.html
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/epl-v10.html b/features/org.eclipse.amalgam.explorer.contextual.core.feature/epl-v10.html
new file mode 100644
index 0000000..90f2d5e
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"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. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.properties b/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.properties
new file mode 100644
index 0000000..2b831aa
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.properties
@@ -0,0 +1,164 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+# NLS_MESSAGEFORMAT_VAR
+
+# "featureName" property - name of the feature
+featureName=Amalgam Contextual Explorer - Core (incubation)
+
+# "providerName" property - name of the company that provides the feature
+providerName=www.eclipse.org
+
+# "description" property - description of the feature
+description=Amalgam Contextual Explorer - Core (Incubation)
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES. \n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+ \n\
+ Contributors:\n\
+ Thales - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.xml b/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.xml
new file mode 100644
index 0000000..5d25c79
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/feature.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<feature
+ id="org.eclipse.amalgam.explorer.contextual.core.feature"
+ label="%featureName"
+ version="0.8.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.amalgam.explorer.contextual.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.amalgam.explorer.contextual.core.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.core.feature/license.html b/features/org.eclipse.amalgam.explorer.contextual.core.feature/license.html
new file mode 100644
index 0000000..6930540
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.core.feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/.project b/features/org.eclipse.amalgam.explorer.contextual.feature/.project
new file mode 100644
index 0000000..161f077
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/build.properties b/features/org.eclipse.amalgam.explorer.contextual.feature/build.properties
new file mode 100644
index 0000000..77eaa71
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/build.properties
@@ -0,0 +1,15 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/epl-v10.html b/features/org.eclipse.amalgam.explorer.contextual.feature/epl-v10.html
new file mode 100644
index 0000000..90f2d5e
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"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. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/feature.properties b/features/org.eclipse.amalgam.explorer.contextual.feature/feature.properties
new file mode 100644
index 0000000..9a0022e
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/feature.properties
@@ -0,0 +1,164 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+# NLS_MESSAGEFORMAT_VAR
+
+# "featureName" property - name of the feature
+featureName=Amalgam Contextual Explorer (incubation)
+
+# "providerName" property - name of the company that provides the feature
+providerName=www.eclipse.org
+
+# "description" property - description of the feature
+description=Amalgam Contextual Explorer (Incubation)
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.\n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+ \n\
+ Contributors:\n\
+ Thales - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/feature.xml b/features/org.eclipse.amalgam.explorer.contextual.feature/feature.xml
new file mode 100644
index 0000000..154af06
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/feature.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<feature
+ id="org.eclipse.amalgam.explorer.contextual.feature"
+ label="%featureName"
+ version="0.8.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.amalgam.explorer.contextual.core.feature" version="0.5.1.qualifier"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.amalgam.explorer.contextual"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.feature/license.html b/features/org.eclipse.amalgam.explorer.contextual.feature/license.html
new file mode 100644
index 0000000..6930540
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/.project b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/.project
new file mode 100644
index 0000000..6aef69a
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.sirius.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/build.properties b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/build.properties
new file mode 100644
index 0000000..77eaa71
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/build.properties
@@ -0,0 +1,15 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/epl-v10.html b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/epl-v10.html
new file mode 100644
index 0000000..90f2d5e
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"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. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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. </span></p>
+
+<p><span style='font-size:10.0pt'>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.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.properties b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.properties
new file mode 100644
index 0000000..65e7a89
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.properties
@@ -0,0 +1,164 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+# NLS_MESSAGEFORMAT_VAR
+
+# "featureName" property - name of the feature
+featureName=Amalgam Contextual Explorer - Sirius integration (incubation)
+
+# "providerName" property - name of the company that provides the feature
+providerName=www.eclipse.org
+
+# "description" property - description of the feature
+description=Amalgam Contextual Explorer - Sirius integration (Incubation)
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\ Copyright (c) 2006, 2015 THALES CORPORATE SERVICES \n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+ \n\
+ Contributors:\n\
+ Thales - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.xml b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.xml
new file mode 100644
index 0000000..02d0fdf
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/feature.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<feature
+ id="org.eclipse.amalgam.explorer.contextual.sirius.feature"
+ label="%featureName"
+ version="0.8.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.amalgam.explorer.contextual.sirius"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.amalgam.explorer.contextual.sirius.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/license.html b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/license.html
new file mode 100644
index 0000000..6930540
--- /dev/null
+++ b/features/org.eclipse.amalgam.explorer.contextual.sirius.feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.classpath b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.classpath
new file mode 100644
index 0000000..b1dabee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.project b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.project
new file mode 100644
index 0000000..9835608
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.core.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5bddc5d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.amalgam.explorer.contextual.core.ui;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.amalgam.explorer.contextual.core.ui.ExplorerContextualActivator
+Bundle-Localization: plugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.amalgam.explorer.contextual.core;visibility:=reexport,
+ org.eclipse.ui.views.properties.tabbed;visibility:=reexport,
+ org.eclipse.sirius
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.amalgam.explorer.contextual.core.ui,
+ org.eclipse.amalgam.explorer.contextual.core.ui.action,
+ org.eclipse.amalgam.explorer.contextual.core.ui.internal,
+ org.eclipse.amalgam.explorer.contextual.core.ui.model,
+ org.eclipse.amalgam.explorer.contextual.core.ui.view,
+ org.eclipse.amalgam.explorer.contextual.core.ui.view.ext
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/about.html b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/about.html
new file mode 100644
index 0000000..c9aa915
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/build.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/build.properties
new file mode 100644
index 0000000..801a315
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/build.properties
@@ -0,0 +1,20 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ icons/,\
+ schema/
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/ctxexplorer_16x16.png b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/ctxexplorer_16x16.png
new file mode 100644
index 0000000..795f575
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/ctxexplorer_16x16.png
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/collapseCategories.gif b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/collapseCategories.gif
new file mode 100644
index 0000000..45971ff
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/collapseCategories.gif
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/license.txt b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/license.txt
new file mode 100644
index 0000000..267cf65
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/license.txt
@@ -0,0 +1,9 @@
+These followings icons are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+<icon file path> - <original eclipse plug-in> - <original file path>
+
+/icons/full/clcl16/refresh.gif - org.eclipse.pde.ui - org.eclipse.pde.ui/icons/elcl16/refresh.gif
+/icons/full/clcl16/synced.gif - org.eclipse.ant.ui - org.eclipse.ant.ui/icons/full/elcl16/synced.gif
+/icons/full/clcl16/collapseCategories.gif - org.eclipse.amalgam.explorer.contextual.core.ui - org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/collapseCategories.gif
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/refresh.gif b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/refresh.gif
new file mode 100644
index 0000000..e383147
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/refresh.gif
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/synced.gif b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/synced.gif
new file mode 100644
index 0000000..870934b
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/full/clcl16/synced.gif
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/license.txt b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/license.txt
new file mode 100644
index 0000000..19ebf26
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/license.txt
@@ -0,0 +1,8 @@
+These followings icons are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+<icon file path> - <original eclipse plug-in> - <original file path>
+
+/icons/ctxexplorer_16x16.png - org.eclipse.amalgam.explorer.contextual.core.ui - org.eclipse.amalgam.explorer.contextual.core.ui/icons/ctxexplorer_16x16.png
+/icons/packd_obj.gif - org.eclipse.jdt.ui - org.eclipse.jdt.ui/icons/full/elcl16/th_showqualified.gif
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/packd_obj.gif b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/packd_obj.gif
new file mode 100644
index 0000000..2556b45
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/icons/packd_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.properties
new file mode 100644
index 0000000..5abad41
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.properties
@@ -0,0 +1,16 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+#Properties file for org.eclipse.amalgam.explorer.contextual.core.ui
+pluginName=Amalgam Contextual Explorer UI Plug-in (Incubation)
+providerName=www.eclipse.org
+
+navigateBackwardCommand=Navigate Back in Contextual Explorer
+navigateForwardCommand=Navigate Forward in Contextual Explorer
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.xml b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.xml
new file mode 100644
index 0000000..2e8554c
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/plugin.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="selectionHelper" name="selectionHelper" schema="schema/selectionHelper.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="org.eclipse.amalgam.explorer.contextual.core.ui.propertyContributorID">
+ <propertyCategory
+ category="default">
+ </propertyCategory>
+ </propertyContributor>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.amalgam.explorer.contextual.core.ui.internal.NavigateBackHandler"
+ id="org.eclipse.amalgam.explorer.contextual.core.ui.backwardNavigation"
+ name="%navigateBackwardCommand">
+ </command>
+ <command
+ defaultHandler="org.eclipse.amalgam.explorer.contextual.core.ui.internal.NavigateForwardHandler"
+ id="org.eclipse.amalgam.explorer.contextual.core.ui.forwardNavigation"
+ name="%navigateForwardCommand">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.amalgam.explorer.contextual.core.ui.backwardNavigation"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="CTRL+ARROW_LEFT">
+ </key>
+ <key
+ commandId="org.eclipse.amalgam.explorer.contextual.core.ui.forwardNavigation"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="CTRL+ARROW_RIGHT">
+ </key>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/schema/selectionHelper.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/schema/selectionHelper.exsd
new file mode 100644
index 0000000..8b0e825
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/schema/selectionHelper.exsd
@@ -0,0 +1,134 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core.ui" id="selectionHelper" name="selectionHelper"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="helper"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="helper">
+ <complexType>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.amalgam.explorer.contextual.core.ui.view.ext.ISelectionHelper"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualActivator.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualActivator.java
new file mode 100644
index 0000000..c39ce51
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualActivator.java
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ExplorerContextualActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.amalgam.explorer.contextual.core.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static ExplorerContextualActivator __plugin;
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ __plugin = this;
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ __plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ * @return the shared instance
+ */
+ public static ExplorerContextualActivator getDefault() {
+ return __plugin;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualPreferences.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualPreferences.java
new file mode 100644
index 0000000..f571404
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/ExplorerContextualPreferences.java
@@ -0,0 +1,20 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui;
+
+/**
+ *
+ */
+public interface ExplorerContextualPreferences {
+
+ public static final String PREFS_DISABLE_CONTEXTUAL_EXPLORER_SYNC_ON_STARTUP = "disable.explorer.contextual.sync"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/IImageKeys.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/IImageKeys.java
new file mode 100644
index 0000000..5e9fc96
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/IImageKeys.java
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui;
+
+/**
+ * Define Contextual Explorer image keys.
+ */
+public interface IImageKeys {
+
+ /**
+ * Image id used in Contextual Explorer to enable listening to page selection events.<br>
+ */
+ public final static String IMG_LISTENING_TO_PAGE_SELECTION_EVENTS = "full/clcl16/synced.gif"; //$NON-NLS-1$
+ /**
+ * Image id used in Contextual Explorer to refresh view.<br>
+ */
+ public final static String IMG_REFRESH = "full/clcl16/refresh.gif"; //$NON-NLS-1$
+
+ /**
+ * Image id used in Contextual Explorer to action "limitate tree expansion".<br>
+ */
+ public final static String IMG_COLLAPSE_CATEGORIES = "full/clcl16/collapseCategories.gif"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/AbstractShowHideAction.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/AbstractShowHideAction.java
new file mode 100644
index 0000000..2b99721
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/AbstractShowHideAction.java
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.action;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+/**
+ *
+ */
+public abstract class AbstractShowHideAction implements IViewActionDelegate {
+
+ /** The Contextual Explorer view **/
+ protected IExplorerContextualViewPart _view;
+
+ /**
+ * Allows to change to change the state of related Category/Categories.
+ * @param state_p the new state
+ * @param model_p the Contextual Explorer model. It is used to read and set
+ * the value of a category show state
+ */
+ public abstract void changeCategoriesStates(boolean state_p, IExplorerContextualModel model_p);
+
+ /**
+ * @return allows implementers to set the initial value of the Category/Categories show state
+ */
+ public abstract boolean getInitialState();
+
+ /**
+ * Update categories state and update the Contextual Explorer View.
+ * @param state_p the value of related categories state
+ */
+ protected void updateView(boolean state_p){
+ changeCategoriesStates(state_p, _view.getModel());
+ Object input = _view.getCurrentViewer().getInput();
+ _view.setInputOnViewers(input);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run(IAction action_p) {
+ updateView(action_p.isChecked());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ // nothing to do
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ @Override
+ public void init(IViewPart view_p) {
+ _view = (IExplorerContextualViewPart) view_p;
+
+ // Initialize to true the Show state of the Sirius categories.
+ changeCategoriesStates(true, _view.getModel());
+
+ // Update the view content.
+ updateView(getInitialState());
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerActionFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerActionFactory.java
new file mode 100644
index 0000000..da637ca
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerActionFactory.java
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.action;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+
+/**
+ *
+ */
+public abstract class ExplorerActionFactory {
+ String actionId_p;
+ /**
+ * Creates a new workbench action factory with the given id.
+ *
+ * @param actionId
+ * the id of actions created by this action factory
+ */
+ protected ExplorerActionFactory(String actionId) {
+ actionId_p = actionId;
+ }
+
+ public abstract IWorkbenchAction create(IWorkbenchWindow window, IExplorerContextualViewPart explorerContextualView_p);
+
+ /**
+ * Workbench action (id "backwardHistory"): Backward in the explorer navigation
+ * history. This action maintains its enablement state.
+ */
+ public static final ExplorerActionFactory BACKWARD_HISTORY = new ExplorerActionFactory("backwardHistory") {//$NON-NLS-1$
+ /**
+ * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window, IExplorerContextualViewPart explorerContextualView_p) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new ExplorerContextualHistoryAction(window, explorerContextualView_p, false);
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id "forwardHistory"): Forward in the explorer navigation
+ * history. This action maintains its enablement state.
+ */
+ public static final ExplorerActionFactory FORWARD_HISTORY = new ExplorerActionFactory("forwardHistory") {//$NON-NLS-1$
+ /**
+ * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window, IExplorerContextualViewPart explorerContextualView_p) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new ExplorerContextualHistoryAction(window, explorerContextualView_p, true);
+ return action;
+ }
+ };
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerContextualHistoryAction.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerContextualHistoryAction.java
new file mode 100644
index 0000000..882e3a3
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerContextualHistoryAction.java
@@ -0,0 +1,240 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.action;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractLabelProviderFactory;
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.ExplorerHistory.ExplorerNavigationHistoryEntry;
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+
+/**
+ */
+public class ExplorerContextualHistoryAction extends Action implements IMenuCreator, IWorkbenchAction {
+ public static final String FORWARD_ACTION_ID = "forward"; //$NON-NLS-1$
+ public static final String BACKWARD_ACTION_ID = "backward"; //$NON-NLS-1$
+ private boolean _forward;
+ private IExplorerContextualViewPart _explorerContextualViewPart;
+ private ExplorerHistory _explorerHistory;
+
+ /**
+ * Action for History Item.
+ */
+ protected class HistoryItemAction extends Action {
+ protected ExplorerNavigationHistoryEntry _navigationEntry;
+
+ /**
+ * Constructor.
+ * @param navigationEntry_p
+ * @param text_p
+ * @param imageDescriptor_p
+ */
+ public HistoryItemAction(ExplorerNavigationHistoryEntry navigationEntry_p, String text_p, ImageDescriptor imageDescriptor_p) {
+ super(text_p, imageDescriptor_p);
+ // object related to the clicked item.
+ _navigationEntry = navigationEntry_p;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ _explorerHistory.setDoUpdate(false);
+ try {
+ // update history model.
+ _explorerHistory.goTo(_navigationEntry);
+ // update Contextual Explorer.
+ _explorerContextualViewPart.setInput(_navigationEntry.getRealObject());
+ _explorerHistory.notifyActionListeners();
+ } finally {
+ // Make sure to re-enable the explorer history.
+ _explorerHistory.setDoUpdate(true);
+ }
+ }
+ }
+
+ /**
+ * Constructor.
+ * @param explorerContextualView_p_p
+ */
+ public ExplorerContextualHistoryAction(IWorkbenchWindow window_p, IExplorerContextualViewPart explorerContextualView_p, boolean forward_p) {
+ _explorerContextualViewPart = explorerContextualView_p;
+ ISharedImages sharedImages = window_p.getWorkbench().getSharedImages();
+ if (forward_p) {
+ setText("&Forward"); //$NON-NLS-1$
+ setToolTipText("Forward"); //$NON-NLS-1$
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+ setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+ setId(FORWARD_ACTION_ID);
+ } else {
+ setText("&Back"); //$NON-NLS-1$
+ setToolTipText("Back"); //$NON-NLS-1$
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+ setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
+ setId(BACKWARD_ACTION_ID);
+ }
+
+ _explorerHistory = explorerContextualView_p.getHistory();
+ _explorerHistory.addActionAsListener(this);
+ _forward = forward_p;
+ setMenuCreator(this);
+ setEnabled(false);
+ }
+
+ /**
+ * Create History action for given object.
+ * @param index_p
+ * @param entry_p
+ * @return
+ */
+ private HistoryItemAction createHistoryAction(ExplorerNavigationHistoryEntry navigationEntry_p) {
+ // Precondition :
+ if (!navigationEntry_p.isValid()) {
+ return null;
+ }
+ Object realObject = navigationEntry_p.getRealObject();
+ ILabelProvider labelProvider = AbstractLabelProviderFactory.getInstance().getCurrentLabelProvider();
+ Image image = labelProvider.getImage(realObject);
+ ImageDescriptor imgDescriptor = null;
+ if (image != null) {
+ imgDescriptor = ImageDescriptor.createFromImage(image);
+ }
+ HistoryItemAction goToAction = new HistoryItemAction(navigationEntry_p, labelProvider.getText(realObject), imgDescriptor);
+ return goToAction;
+ }
+
+ /**
+ * Get available history entries according forward or backward navigation.
+ * @return
+ */
+ private List<ExplorerNavigationHistoryEntry> getAvailableNavigationEntries() {
+ List<ExplorerNavigationHistoryEntry> historyEntries = null;
+ if (_forward) {
+ historyEntries = _explorerHistory.getForwardNavigationEntries();
+ } else {
+ historyEntries = _explorerHistory.getBackwardNavigationEntries();
+ Collections.reverse(historyEntries);
+ }
+ return historyEntries;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent_p) {
+ MenuManager menuManager = new MenuManager();
+ final Menu menu = menuManager.createContextMenu(parent_p);
+ menuManager.addMenuListener(new IMenuListener() {
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("synthetic-access")
+ public void menuAboutToShow(IMenuManager manager_p) {
+ // Retrieve entries for the menu.
+ List<ExplorerNavigationHistoryEntry> navigationEntries = getAvailableNavigationEntries();
+ // Populate the menu with entries.
+ for (ExplorerNavigationHistoryEntry entry : navigationEntries) {
+ HistoryItemAction historyEntryAction = createHistoryAction(entry);
+ if (null != historyEntryAction) {
+ manager_p.add(historyEntryAction);
+ }
+ }
+ }
+ });
+ // Add a listener to automatically dispose the menu when it becomes hidden.
+ final Display display = menu.getDisplay();
+ menu.addListener(SWT.Hide, new Listener() {
+ public void handleEvent(Event event) {
+ if (!display.isDisposed()) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (!menu.isDisposed()) {
+ menu.dispose();
+ }
+ }
+ });
+ }
+ }
+ });
+ return menu;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent_p) {
+ // Not applicable.
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ Iterator<ExplorerNavigationHistoryEntry> availableHistoryEntries = getAvailableNavigationEntries().iterator();
+ if (availableHistoryEntries.hasNext()) {
+ // Create an action to go to the first available entry.
+ HistoryItemAction historyAction = createHistoryAction(availableHistoryEntries.next());
+ while (null == historyAction) {
+ historyAction = createHistoryAction(availableHistoryEntries.next());
+ }
+ if (null != historyAction) {
+ historyAction.run();
+ }
+ }
+ }
+
+ /**
+ * Update control state.
+ */
+ protected void updateControlState() {
+ boolean enabled = false;
+ if (_forward) {
+ if (_explorerHistory.getForwardNavigationEntries().size() > 0) {
+ enabled = true;
+ }
+ } else {
+ if (_explorerHistory.getBackwardNavigationEntries().size() > 0) {
+ enabled = true;
+ }
+ }
+ setEnabled(enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ // Do nothing.
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerHistory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerHistory.java
new file mode 100644
index 0000000..5ac4860
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/action/ExplorerHistory.java
@@ -0,0 +1,209 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.action;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * History services for explorer.
+ */
+public class ExplorerHistory {
+ /**
+ * Explorer navigation history entry.
+ */
+ protected class ExplorerNavigationHistoryEntry {
+ /**
+ * Weak reference on a model element object.
+ */
+ private WeakReference<Object> _referencedObject;
+
+ /**
+ * Constructor.
+ * @param realObject_p The underlying object to navigate to.
+ */
+ protected ExplorerNavigationHistoryEntry(Object realObject_p) {
+ _referencedObject = new WeakReference<Object>(realObject_p);
+ }
+
+ /**
+ * Get the underlying object to navigate to.
+ * @return can be <code>null</code> if object is unloaded.
+ */
+ public Object getRealObject() {
+ return _referencedObject.get();
+ }
+
+ public boolean isValid() {
+ boolean result = true;
+ Object realObject = getRealObject();
+ if ((null == realObject) || ((realObject instanceof EObject) && ((EObject) realObject).eIsProxy())) {
+ result = false;
+ }
+ return result;
+ }
+ }
+
+ private static final int MAX_SIZE = 10;
+
+ /**
+ * Actions to notify when the history is updated.
+ */
+ private List<ExplorerContextualHistoryAction> _actionAsListeners;
+
+ /**
+ * Current index. When its Zero that means there is no element in history.
+ */
+ private int _currentEntryIndex;
+ /**
+ * Internal navigation history.
+ */
+ private List<ExplorerNavigationHistoryEntry> _entries;
+
+ /**
+ * do update when update doesn't come from an update.
+ */
+ private boolean _shouldDoUpdate;
+
+ /**
+ * Constructor.
+ */
+ public ExplorerHistory() {
+ _currentEntryIndex = -1;
+ _shouldDoUpdate = true;
+ _entries = new ArrayList<ExplorerNavigationHistoryEntry>(MAX_SIZE);
+ _actionAsListeners = new ArrayList<ExplorerContextualHistoryAction>(2);
+ }
+
+ /**
+ * Add specified action as explorer history listener.
+ * @param action_p
+ */
+ public void addActionAsListener(ExplorerContextualHistoryAction action_p) {
+ _actionAsListeners.add(action_p);
+ }
+
+ /**
+ * Clean dead entries i.e entries that reference objects which are no longer loaded.
+ */
+ private void cleanDeadEntries() {
+ Iterator<ExplorerNavigationHistoryEntry> iterator = _entries.iterator();
+ int i = 0;
+ while (iterator.hasNext()) {
+ ExplorerHistory.ExplorerNavigationHistoryEntry historyEntry = iterator.next();
+ if (!historyEntry.isValid()) {
+ iterator.remove();
+ // Shift back the current entry index.
+ if (_currentEntryIndex == i) {
+ _currentEntryIndex--;
+ }
+ }
+ i++;
+ }
+ // Handle out of bounds.
+ if (_currentEntryIndex >= _entries.size()) {
+ _currentEntryIndex = _entries.size() - 1;
+ } else if (_currentEntryIndex < 0) {
+ _currentEntryIndex = 0;
+ }
+ }
+
+ /**
+ * Dispose internal entries.
+ */
+ public void dispose() {
+ if (null != _entries) {
+ _entries.clear();
+ _entries = null;
+ }
+ if (null != _actionAsListeners) {
+ _actionAsListeners.clear();
+ _actionAsListeners = null;
+ }
+ _currentEntryIndex = -1;
+ }
+
+ /**
+ * Get backward navigation entries.
+ * @return
+ */
+ public List<ExplorerNavigationHistoryEntry> getBackwardNavigationEntries() {
+ List<ExplorerNavigationHistoryEntry> result = Collections.emptyList();
+ if (!_entries.isEmpty()) {
+ result = new ArrayList<ExplorerNavigationHistoryEntry>(_entries.subList(0, _currentEntryIndex));
+ }
+ return result;
+ }
+
+ /**
+ * Get forward navigation entries.
+ * @return
+ */
+ public List<ExplorerNavigationHistoryEntry> getForwardNavigationEntries() {
+ List<ExplorerNavigationHistoryEntry> result = Collections.emptyList();
+ if (_currentEntryIndex < (_entries.size() - 1)) {
+ result = new ArrayList<ExplorerNavigationHistoryEntry>(_entries.subList(_currentEntryIndex + 1, _entries.size()));
+ }
+ return result;
+ }
+
+ /**
+ * Go to specified navigation entry.
+ * @param navigationEntry_p
+ */
+ public void goTo(ExplorerNavigationHistoryEntry navigationEntry_p) {
+ _currentEntryIndex = _entries.indexOf(navigationEntry_p);
+ }
+
+ /**
+ * Notify registered actions to update themselves.
+ */
+ protected void notifyActionListeners() {
+ for (ExplorerContextualHistoryAction action : _actionAsListeners) {
+ action.updateControlState();
+ }
+ }
+
+ /**
+ * Enable / Disable the update method to avoid re-entrance.
+ * @param doUpdate_p the _shouldDoUpdate to set
+ * @see #update(Object).
+ */
+ public void setDoUpdate(boolean doUpdate_p) {
+ _shouldDoUpdate = doUpdate_p;
+ }
+
+ /**
+ * Update is called when an new input is set. Add element to the history. Update index. retain backward history.
+ * @param realObject_p
+ */
+ public void update(Object realObject_p) {
+ // Clean dead entries i.e entries that reference objects which are no
+ // longer loaded.
+ cleanDeadEntries();
+ if (_shouldDoUpdate && (null != realObject_p)) {
+ // retain backward history only.
+ if (_entries.size() == MAX_SIZE) {
+ _entries.remove(0); // remove the oldest entry.
+ }
+ // Add new entry.
+ _entries.add(new ExplorerNavigationHistoryEntry(realObject_p));
+ _currentEntryIndex = _entries.size() - 1;
+ }
+ // Notify actions to update them.
+ notifyActionListeners();
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/AbstractNavigateBackHandler.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/AbstractNavigateBackHandler.java
new file mode 100644
index 0000000..4f28e30
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/AbstractNavigateBackHandler.java
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.internal;
+
+import java.util.Map;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.ExplorerContextualHistoryAction;
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+
+
+/**
+ * Base class to implement the handler for backward & forward navigation in the Contextual Explorer.
+ */
+public abstract class AbstractNavigateBackHandler extends AbstractHandler implements IElementUpdater {
+ /**
+ * {@inheritDoc}
+ */
+ public Object execute(ExecutionEvent event_p) throws ExecutionException {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ IWorkbenchPart activePart = activePage.getActivePart();
+// String id = activePart.getSite().getId();
+// IExplorerContextualViewPart explorerContextual = (IExplorerContextualViewPart) activePage.findView(ExplorerContextualView.getExplorerContextualViewID());
+// IViewPart findView = activePage.findView(id);
+ if (null != activePart && activePart instanceof IExplorerContextualViewPart)
+ {
+ IExplorerContextualViewPart explorerContextual = (IExplorerContextualViewPart) activePart;
+ ExplorerContextualHistoryAction explorerContextualHistoryAction = new ExplorerContextualHistoryAction(activeWorkbenchWindow, explorerContextual, isForwardNavigation());
+ explorerContextualHistoryAction.run();
+ explorerContextualHistoryAction.dispose();
+ explorerContextualHistoryAction = null;
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+@Override
+ public void updateElement(UIElement element, Map parameters) {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ * Is given action the forward action ?
+ * @return <code>true</code> means yes;<code>false</code> means backward navigation.
+ */
+ protected abstract boolean isForwardNavigation();
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateBackHandler.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateBackHandler.java
new file mode 100644
index 0000000..cedf754
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateBackHandler.java
@@ -0,0 +1,23 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.internal;
+
+/**
+ */
+public class NavigateBackHandler extends AbstractNavigateBackHandler {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isForwardNavigation() {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateForwardHandler.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateForwardHandler.java
new file mode 100644
index 0000000..5802c04
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/internal/NavigateForwardHandler.java
@@ -0,0 +1,23 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.internal;
+
+/**
+ */
+public class NavigateForwardHandler extends AbstractNavigateBackHandler {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isForwardNavigation() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/model/ExplorerContextualModel.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/model/ExplorerContextualModel.java
new file mode 100644
index 0000000..05bf69d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/model/ExplorerContextualModel.java
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryImpl;
+import org.eclipse.amalgam.explorer.contextual.core.category.ICategory;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+
+public class ExplorerContextualModel implements IExplorerContextualModel {
+
+ /** This Map is used to store the categories show state **/
+ protected Map<String, Boolean> _categoryShowHide = new HashMap<String, Boolean>();
+
+ protected boolean limitateTreeExpansion = false; // default value
+
+ protected Hashtable<String, List<String>> explorerID2ExpandedObjectHashcodes = new Hashtable<String, List<String>>();
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel#setCategoryShowState(java.lang.String, boolean)
+ */
+ public void setCategoryShowState(String categoryName_p, boolean showState_p){
+ _categoryShowHide.put(categoryName_p, showState_p);
+ }
+
+ /**
+ * Return the value of the category state saved in the model ({@link IExplorerContextualModel})
+ * If there is no saved state in the model, the default value is True.
+ * @param categoryName_p name of the category
+ * @return True is the category show state is on or if there is no saved state for the category.
+ * False otherwise
+ */
+ public boolean getCategoryShowState(String categoryName_p){
+ if (_categoryShowHide.containsKey(categoryName_p))
+ return _categoryShowHide.get(categoryName_p).booleanValue();
+ return true;
+ }
+
+ @Override
+ public boolean doesLimitateTreeExpansion() {
+ return limitateTreeExpansion;
+ }
+
+ @Override
+ public void setLimitateTreeExpansion(boolean limitateTreeExpansion_p) {
+ limitateTreeExpansion = limitateTreeExpansion_p;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel#doesShowCategory(org.eclipse.amalgam.explorer.contextual.core.category.ICategory)
+ */
+ @Override
+ public boolean doesShowCategory(ICategory category) {
+ if (_categoryShowHide.containsKey(category.getName()))
+ return getCategoryShowState(category.getName());
+
+ return true;
+ }
+
+ @Override
+ public void saveExpandedState(CategoryImpl category, String explorerID, boolean expanded) {
+ List<String> expandedObjects = getOrCreateHistory(explorerID);
+ String hashcode = getHashcode(category);
+ if (expandedObjects.contains(hashcode) && !expanded) {
+ expandedObjects.remove(hashcode);
+ } else if (!expandedObjects.contains(hashcode) && expanded) {
+ expandedObjects.add(hashcode);
+ }
+ }
+
+ @Override
+ public boolean getExpandedState(ICategory category, String explorerID) {
+ if (doesLimitateTreeExpansion()) {
+ List<String> expandedObjects = explorerID2ExpandedObjectHashcodes.get(explorerID);
+ if (expandedObjects != null) {
+ if (!expandedObjects.contains(getHashcode(category))) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean containsExpandedHistory(String explorerID) {
+ return explorerID2ExpandedObjectHashcodes.containsKey(explorerID);
+ }
+
+ @Override
+ public List<String> getOrCreateHistory(String explorerID) {
+ List<String> nonExpandedObjects = explorerID2ExpandedObjectHashcodes.get(explorerID);
+ if (nonExpandedObjects == null) {
+ nonExpandedObjects = new ArrayList<String>();
+ explorerID2ExpandedObjectHashcodes.put(explorerID, nonExpandedObjects);
+ }
+ return nonExpandedObjects;
+ }
+
+ private String getHashcode(ICategory category) {
+ return category.getName();
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ClosedSessionListener.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ClosedSessionListener.java
new file mode 100644
index 0000000..c212e96
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ClosedSessionListener.java
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionListener;
+
+/**
+ */
+public class ClosedSessionListener implements SessionListener {
+ /**
+ * Monitored session.
+ */
+ private Session _monitoredSession;
+
+ /**
+ * Constructor.
+ * @param session_p
+ */
+ public ClosedSessionListener(Session session_p) {
+ _monitoredSession = session_p;
+ }
+
+ /**
+ * Get monitored session.
+ * @return <code>null</code> {@link #handleClosedSession(Session)} is called.
+ */
+ protected Session getMonitoredSession() {
+ return _monitoredSession;
+ }
+
+ /**
+ * Call when notified for Closed session event i.e {@link SessionListener#CLOSED}.<br>
+ * Default implementation automatically unregisters this listener from closed session.
+ * @param monitoredSession_p
+ */
+ protected void handleClosedSession(Session monitoredSession_p) {
+ // Unregister from the session
+ _monitoredSession.removeListener(this);
+ _monitoredSession = null;
+ }
+
+ /**
+ * Call when notified for Closing session event i.e {@link SessionListener#CLOSING}.<br>
+ * Default implementation does nothing.
+ * @param monitoredSession_p
+ */
+ protected void handleClosingSession(Session monitoredSession_p) {
+ // Do nothing.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void notify(int changeKind_p) {
+ switch (changeKind_p) {
+ case SessionListener.CLOSING:
+ handleClosingSession(_monitoredSession);
+ break;
+ case SessionListener.CLOSED:
+ handleClosedSession(_monitoredSession);
+ break;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/DelegateSelectionProvider.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/DelegateSelectionProvider.java
new file mode 100644
index 0000000..a1c330a
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/DelegateSelectionProvider.java
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+/**
+ * Delegate Selection Provider.
+ */
+public class DelegateSelectionProvider implements ISelectionProvider {
+ private ISelectionProvider _delegate;
+
+ /**
+ * Constructor.
+ * @param selectionProvider_p
+ */
+ public DelegateSelectionProvider(ISelectionProvider selectionProvider_p) {
+ _delegate = selectionProvider_p;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ _delegate.addSelectionChangedListener(listener);
+
+ }
+
+ /**
+ * Get the delegate selection provider.
+ * @return a not <code>null</code> object.
+ */
+ public ISelectionProvider getDelegate() {
+ return _delegate;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ISelection getSelection() {
+ return _delegate.getSelection();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ _delegate.removeSelectionChangedListener(listener);
+ }
+
+ /**
+ * Set the delegate
+ * @param delegate_p the delegate to set
+ */
+ public void setDelegate(ISelectionProvider delegate_p) {
+ _delegate = delegate_p;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSelection(ISelection selection) {
+ _delegate.setSelection(selection);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerComposite.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerComposite.java
new file mode 100644
index 0000000..95e588c
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerComposite.java
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Composite that contains a Treeview and its label.
+ */
+
+public class ExplorerComposite extends Composite {
+
+ protected TreeViewer treeviewer;
+
+ protected Label label;
+
+ public ExplorerComposite(Composite parent_p, IExplorerContextualModel model, int style_p, String labelText_p, String explorerID) {
+ super(parent_p, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(1, true);
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginBottom = 0;
+ gridLayout.marginTop = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginRight = 0;
+ gridLayout.marginLeft = 0;
+ setLayout(gridLayout);
+
+ if ((labelText_p != null) && (labelText_p.length() > 0)) {
+ label = new Label(this, SWT.NONE);
+ label.setText(labelText_p);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ label.setLayoutData(gridData);
+
+ label.setBackground(label.getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ label.setForeground(label.getShell().getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ }
+ // Style given to the Tree should contain SWT.MULTI (as in this constructor) to have a beautiful drag feedback (else it's an ugly rectangle...).
+ treeviewer = new ExplorerContextualTree(this, model, explorerID);
+ }
+
+ /**
+ * @return the treeviewer
+ */
+ public TreeViewer getTreeviewer() {
+ return treeviewer;
+ }
+
+ /**
+ * @return the label
+ */
+ public Label getLabel() {
+ return label;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualTree.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualTree.java
new file mode 100644
index 0000000..50bd25b
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualTree.java
@@ -0,0 +1,148 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryImpl;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.IExplorerContentProvider;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.EObjectWrapper;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class ExplorerContextualTree extends TreeViewer {
+
+ protected IExplorerContextualModel model;
+ protected String explorerID;
+
+ public ExplorerContextualTree(Composite parent, IExplorerContextualModel model_p, String explorerID_p) {
+ super(parent);
+ explorerID = explorerID_p;
+ model = model_p;
+ updateAutoExpandLevel();
+ getTree().addListener(SWT.Expand, new TreeItemListenerForHistory(true, explorerID, model, this));
+ getTree().addListener(SWT.Collapse, new TreeItemListenerForHistory(false, explorerID, model, this));
+ }
+
+ protected void updateAutoExpandLevel() {
+ if (model.doesLimitateTreeExpansion()) {
+ if (explorerID == IExplorerContentProvider.ID_CURRENT_CP) {
+ setAutoExpandLevel(3);
+ } else {
+ setAutoExpandLevel(2);
+ }
+ } else {
+ setAutoExpandLevel(ALL_LEVELS);
+ }
+ }
+
+ @Override
+ protected Item[] getSelection(Control widget) {
+ Item[] itemlList = ((Tree) widget).getSelection();
+ for (Item item : itemlList) {
+ Object data = item.getData();
+ if (data instanceof EObjectWrapper) {
+ EObjectWrapper wrapper = (EObjectWrapper) data;
+ item.setData(wrapper.getElement());
+ }
+ }
+ return itemlList;
+ }
+
+ @Override
+ protected ColumnViewerEditor createViewerEditor() {
+ // Disable ColumnViewer editing support.
+ return null;
+ }
+
+ // store complete history of expand state
+ protected void initializeHistory() {
+ model.getOrCreateHistory(explorerID);// because it is possible that no save is done and table must be initialized
+ for (TreeItem treeItem : getAllItems()) {
+ if (!getExpanded(treeItem)) {
+ Object data = treeItem.getData();
+ if ((data != null) && (data instanceof CategoryWrapper)) {
+ CategoryImpl category = (CategoryImpl) ((CategoryWrapper) data).getElement();
+ model.saveExpandedState(category, explorerID, false);
+ }
+ }
+ }
+ }
+
+ // restore the expansion state of the given input
+ protected void restoreExpansionState(Object input) {
+ TreeItem topItem = getTree().getTopItem();
+ for (TreeItem treeItem : getAllItems()) {
+ Object data = treeItem.getData();
+ if (data != null) {
+ if (model.doesLimitateTreeExpansion()) {
+ if (data instanceof CategoryWrapper) {
+ CategoryImpl category = (CategoryImpl) ((CategoryWrapper) data).getElement();
+ boolean expanded = model.getExpandedState(category, explorerID);
+ treeItem.setExpanded(expanded);
+ } else if ((explorerID == IExplorerContentProvider.ID_CURRENT_CP) && (treeItem == topItem)) {
+ treeItem.setExpanded(true);
+ } else {
+ treeItem.setExpanded(false);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void inputChanged(Object input, Object oldInput) {
+ // before tree update, we update the expansion depth and initialize history if necessary
+ updateAutoExpandLevel();
+ // we initialize history for the current tree if necessary
+ if (oldInput != null) {
+ if (!model.containsExpandedHistory(explorerID)) {
+ initializeHistory();
+ }
+ }
+ super.inputChanged(input, oldInput);
+ // after tree update, we set the current input in the model and refresh expansion state from the history if defined
+ if ((input != null) && model.containsExpandedHistory(explorerID)) {
+ restoreExpansionState(input);
+ }
+ }
+
+ // return a list of all items of tree whose data is not null
+ private List<TreeItem> getAllItems() {
+ List<TreeItem> allItems = new ArrayList<TreeItem>();
+ for (TreeItem item : getTree().getItems()) {
+ if (item.getData() != null) {
+ allItems.add(item);
+ getAllItems(item, allItems);
+ }
+ }
+ return allItems;
+ }
+
+ private void getAllItems(TreeItem currentItem, List<TreeItem> allItems) {
+ for (TreeItem element : currentItem.getItems()) {
+ if (element.getData() != null) {
+ allItems.add(element);
+ getAllItems(element, allItems);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualView.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualView.java
new file mode 100644
index 0000000..12ac1d2
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ExplorerContextualView.java
@@ -0,0 +1,1373 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.MissingResourceException;
+
+import org.apache.log4j.Logger;
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.category.ICategory;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProvider;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProviderFactory;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractLabelProviderFactory;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.ExplorerElementWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.ui.IImageKeys;
+import org.eclipse.amalgam.explorer.contextual.core.ui.ExplorerContextualActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ui.ExplorerContextualPreferences;
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.ExplorerActionFactory;
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.ExplorerHistory;
+import org.eclipse.amalgam.explorer.contextual.core.ui.model.ExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ext.SelectionHelpersManager;
+import org.eclipse.amalgam.explorer.contextual.core.util.ViewerHelper;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.bindings.keys.IKeyLookup;
+import org.eclipse.jface.bindings.keys.KeyLookupFactory;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Contextual Explorer View. Load by extension point.
+ */
+@SuppressWarnings("restriction")
+public abstract class ExplorerContextualView extends ViewPart implements IExplorerContextualViewPart,
+ ITabbedPropertySheetPageContributor{
+ /**
+ * Contextual Explorer contributor ID
+ */
+ public static final String EXPLORER_CONTEXTUAL_CONTRIBUTOR_ID = "org.eclipse.amalgam.explorer.contextual.core.ui.propertyContributorID";
+
+ public static String getExplorerContextualViewID(){
+ return "";
+ }
+
+ /**
+ * Whether or not the view is listening page selection events.<br>
+ * Hopefully there is only one instance of a Contextual Explorer at runtime.
+ */
+ private static volatile boolean __isListeningToPageSelectionEvents;
+
+ /**
+ * Category name displayed in Current Viewer.<br>
+ */
+ private static final String ALL_RELATED_DIAGRAMS = "All Related Diagrams"; //$NON-NLS-1$
+ /**
+ * Category name displayed in Current Viewer.<br>
+ */
+ private static final String ALL_RELATED_TABLES = "All Related Tables"; //$NON-NLS-1$
+ /**
+ * Constant used to persist if the view is listening workbench page selection events.
+ */
+ private static final String LISTENING_TO_WORKBENCH_PAGE_SELECTION_EVENTS = "listeningToWorkbenchPageSelectionEvents"; //$NON-NLS-1$
+ /**
+ * Text of the label for Referencing Elements explorer.
+ */
+ private static final String REFERENCING_ELEMENTS_LABEL_TXT = Messages.ExplorerContextualView_Referencing_Elements_Title;
+
+ /**
+ * Memento persistence tag.
+ */
+ private static final String TAG_MEMENTO = "memento"; //$NON-NLS-1$
+ /**
+ * Back navigation action.
+ */
+ private IWorkbenchAction _backAction;
+
+ private TreeViewer _currentViewer;
+ private DelegateSelectionProvider _delegateSelectionProvider;
+ /**
+ * Forward navigation action.
+ */
+ private IWorkbenchAction _forwardAction;
+
+ /**
+ * Navigation history.
+ */
+ private ExplorerHistory _history;
+
+ /**
+ * Is CTRL key pressed when a double click is emitted ?
+ */
+ private boolean _isCtrlKeyPressed;
+ /**
+ * Memento used to persist view states between sessions.
+ */
+ private IMemento _memento;
+ private Map<Session, SemClosedSessionListener> _monitoredSessions;
+ private TabbedPropertySheetPage _propertySheetPage;
+ private TreeViewer _referencedViewer;
+ /**
+ * Default viewers embedded into the view.
+ */
+ private TreeViewer _referencingViewer;
+ private ISelectionListener _selectionListener;
+ private TabbedPropertyTitle _explorerContextualTitle;
+
+ /**
+ * Used to drive setFocus from setInput.
+ */
+ private boolean _shouldSetFocus;
+ private IDoubleClickListener _viewerDoubleClickListener;
+
+ private ISelectionChangedListener _viewerSelectionListener;
+
+ /**
+ * Dialog settings for this view.
+ */
+ private IDialogSettings _viewSettings;
+
+ protected IExplorerContextualModel model;
+
+ /**
+ * Constructor.
+ */
+ public ExplorerContextualView() {
+ // Get the dialog settings section for this view.
+ _viewSettings = getDialogSettingsSection();
+ _monitoredSessions = new HashMap<Session, ExplorerContextualView.SemClosedSessionListener>(1);
+ model = new ExplorerContextualModel();
+ }
+
+ /**
+ * Monitor the session that loads specified element.
+ * @param element_p
+ */
+ protected void monitorSessionClosingEvent(EObject element_p) {
+ Session session = SessionManager.INSTANCE.getSession(element_p);
+ if ((null != session) && !_monitoredSessions.containsKey(session))
+ {
+ SemClosedSessionListener listener = new SemClosedSessionListener(session);
+ session.addListener(listener);
+ _monitoredSessions.put(session, listener);
+ }
+ }
+
+ @Override
+ public IExplorerContextualModel getModel() {
+ return model;
+ }
+
+ /**
+ * Activate the listening to page selection events.
+ */
+ public void activateListeningToPageSelectionEvents() {
+ _selectionListener = getSelectionListener();
+ if (null != _selectionListener) {
+ getSite().getPage().addSelectionListener(_selectionListener);
+ }
+ __isListeningToPageSelectionEvents = true;
+ }
+
+ /**
+ * Adds drag support to given viewer. The drag transfer type is LocalSelectionTransfer.
+ * @param viewer_p
+ */
+ protected void addDndDragSupport(final TreeViewer viewer_p) {
+ int operations = DND.DROP_MOVE;
+ Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
+ // The DragSourceListener implementation is inspired by org.eclipse.debug.internal.ui.views.variables.SelectionDragAdapter.
+ viewer_p.addDragSupport(operations, transferTypes, new DragSourceListener() {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dragSetData(DragSourceEvent event_p) {
+ event_p.data = LocalSelectionTransfer.getTransfer().getSelection();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dragStart(DragSourceEvent event_p) {
+ // Check selection to drag is a Semantic Element.
+ ISelection selection = viewer_p.getSelection();
+ if ((selection != null) && (selection instanceof IStructuredSelection)
+ && (isSemanticElements(((IStructuredSelection) selection).toList()))) {
+ // Fill LocalSelectionTransfer.
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(event_p.time & 0xFFFFFFFFL);
+ // Allow drag operation.
+ event_p.doit = true;
+ } else {
+ // Forbid drag operation.
+ event_p.doit = false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dragFinished(DragSourceEvent event_p) {
+ // Clean LocalSelectionTranfer.
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
+ }
+ });
+ }
+
+ /**
+ * <p>
+ * Adds a double click listeners to the given viewer.
+ * </p>
+ * @param viewer_p The viewer
+ */
+ protected void addListeners(TreeViewer viewer_p) {
+ // Lazy creation pattern.
+ if (null == _viewerSelectionListener) {
+ _viewerSelectionListener = new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelectionProvider provider = event.getSelectionProvider();
+ refreshPropertyPage(provider);
+ }
+ };
+ }
+ // Register the listener.
+ viewer_p.addSelectionChangedListener(_viewerSelectionListener);
+
+ // Add a focus listener to update the selection provider.
+ viewer_p.getControl().addFocusListener(new FocusAdapter() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void focusGained(FocusEvent event_p) {
+ Object source = event_p.getSource();
+ ISelectionProvider newSelectionProvider = null;
+ if (source.equals(_currentViewer.getControl())) {
+ newSelectionProvider = _currentViewer;
+ } else if (source.equals(_referencedViewer.getControl())) {
+ newSelectionProvider = _referencedViewer;
+ } else if (source.equals(_referencingViewer.getControl())) {
+ newSelectionProvider = _referencingViewer;
+ }
+ if (null != newSelectionProvider) {
+ updateSelectionProvider(newSelectionProvider);
+ refreshPropertyPage(newSelectionProvider);
+ }
+ }
+ });
+
+ // Lazy creation pattern.
+ if (null == _viewerDoubleClickListener) {
+ _viewerDoubleClickListener = new IDoubleClickListener() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void doubleClick(DoubleClickEvent event_p) {
+ try {
+ handleDoubleClick(event_p);
+ } catch (RuntimeException exception_p) {
+ StringBuilder loggerMessage = new StringBuilder("ExplorerContextualView.addListeners(..) _ "); //$NON-NLS-1$
+ loggerMessage.append(exception_p.getMessage());
+ logError(loggerMessage.toString(), exception_p);
+ }
+ }
+ };
+ }
+ // Register the listener.
+ viewer_p.addDoubleClickListener(_viewerDoubleClickListener);
+ viewer_p.getControl().addKeyListener(new KeyAdapter() {
+ /**
+ * Is CTRL pressed for specified key event.
+ * @param event_p
+ * @return
+ */
+ protected boolean isCtrlPressed(KeyEvent event_p) {
+ IKeyLookup keyLookup = KeyLookupFactory.getSWTKeyLookup();
+ return keyLookup.getCtrl() == event_p.stateMask || keyLookup.getCtrl() == event_p.keyCode;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void keyPressed(KeyEvent keyEvent_p) {
+ if (isCtrlPressed(keyEvent_p)) {
+ _isCtrlKeyPressed = true;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void keyReleased(KeyEvent keyEvent_p) {
+ if (isCtrlPressed(keyEvent_p)) {
+ _isCtrlKeyPressed = false;
+ }
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart#clean()
+ */
+ @Override
+ public void clean() {
+ // No need to set focus.
+ boolean restoreState = _shouldSetFocus ? true : false;
+ _shouldSetFocus = false;
+ setInput(null);
+ if (restoreState) {
+ _shouldSetFocus = true;
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createPartControl(Composite parent_p) {
+ // Create and set a layout on the parent.
+ GridLayout layout = new GridLayout();
+ // No blank space.
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ parent_p.setLayout(layout);
+ // Creates the title composite
+ _explorerContextualTitle = new TabbedPropertyTitle(parent_p, new TabbedPropertySheetWidgetFactory());
+ GridData titleLayoutData = new GridData(GridData.FILL_HORIZONTAL);
+ // Do grab excess vertical space.
+ titleLayoutData.grabExcessVerticalSpace = false;
+ _explorerContextualTitle.setLayoutData(titleLayoutData);
+ // Sets a default name with no image
+ _explorerContextualTitle.setTitle(Messages.ExplorerContextualView_Default_Name, null);
+
+ // Create the main sash form that host inner viewers.
+ SashForm mainSashForm = new SashForm(parent_p, SWT.HORIZONTAL);
+ Layout gridLayoutTop = new GridLayout(3, true);
+ mainSashForm.setLayout(gridLayoutTop);
+ mainSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // set the model in the AbstractContentProviderFactory
+ AbstractContentProviderFactory.getInstance().setModel(model);
+
+ // Initialize referencing viewer as first element of the main sash form.
+ ViewerSorter sorter = new ViewerSorter();
+ AbstractContentProvider treeProvider = (AbstractContentProvider) AbstractContentProviderFactory.getInstance().getReferencingContentProvider();
+ _referencingViewer = createViewer(mainSashForm, REFERENCING_ELEMENTS_LABEL_TXT, 3, treeProvider.getExplorerId());
+ initializeViewer(_referencingViewer, treeProvider, AbstractLabelProviderFactory.getInstance().getReferencingLabelProvider(), sorter);
+
+ // Create a sash form as second element of the main sash form.
+ // Initialize current viewer as first element of the center sash form.
+ treeProvider = (AbstractContentProvider) AbstractContentProviderFactory.getInstance().getCurrentContentProvider();
+ _currentViewer = createViewer(mainSashForm, Messages.ExplorerContextualView_Current_Element_Title, 3, treeProvider.getExplorerId());
+ initializeViewer(_currentViewer, treeProvider, AbstractLabelProviderFactory.getInstance().getCurrentLabelProvider(), new ViewerSorter() {
+ /**
+ * Overridden to force All Related Diagrams and All Related Tables to be located at the end of the tree. {@inheritDoc}
+ */
+ @Override
+ public int compare(Viewer viewer_p, Object e1_p, Object e2_p) {
+ if (e1_p instanceof CategoryWrapper) {
+ if (isRepresentationCategory((CategoryWrapper) e1_p)) {
+ return 1;
+ }
+ }
+ if (e2_p instanceof CategoryWrapper) {
+ if (isRepresentationCategory((CategoryWrapper) e2_p)) {
+ return -1;
+ }
+ }
+ return super.compare(viewer_p, e1_p, e2_p);
+ }
+
+ /**
+ * Is given category used to displayed diagrams or tables ?
+ * @param categoryWrapper_p
+ * @return
+ */
+ private boolean isRepresentationCategory(CategoryWrapper categoryWrapper_p) {
+ ICategory category = (ICategory) (categoryWrapper_p).getElement();
+ String categoryName = category.getName();
+ return categoryName.equals(ALL_RELATED_DIAGRAMS) || categoryName.equals(ALL_RELATED_TABLES);
+ }
+ });
+
+ // Initialize the referenced viewer as third element of the main sash
+ // form.
+ treeProvider = (AbstractContentProvider) AbstractContentProviderFactory.getInstance().getReferencedContentProvider();
+ _referencedViewer = createViewer(mainSashForm, Messages.ExplorerContextualView_Referenced_Elements_Title, 3, treeProvider.getExplorerId());
+ initializeViewer(_referencedViewer, treeProvider, AbstractLabelProviderFactory.getInstance().getReferencedLabelProvider(), sorter);
+
+ initializeContextMenus();
+ // Create and set a delegate selection provider, initialized on current
+ // viewer.
+ _delegateSelectionProvider = new DelegateSelectionProvider(_currentViewer);
+ getViewSite().setSelectionProvider(_delegateSelectionProvider);
+ makeActions();
+ }
+
+ /**
+ * Create a composite widget which contains a treeviewer.
+ * @param parent_p
+ * @param label_p
+ * @param autoExpandLevel_p
+ * @param explorerID
+ * @return the referenced treeviewer
+ */
+ protected TreeViewer createViewer(Composite parent_p, String label_p, int autoExpandLevel_p, String explorerID) {
+ ExplorerComposite composite = new ExplorerComposite(parent_p, model, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, label_p, explorerID);
+ TreeViewer treeViewer = composite.getTreeviewer();
+ // treeViewer.setAutoExpandLevel(autoExpandLevel_p);
+ treeViewer.setUseHashlookup(true);
+ ColumnViewerToolTipSupport.enableFor(treeViewer, ToolTip.RECREATE);
+ addListeners(treeViewer);
+ addDndDragSupport(treeViewer);
+ return treeViewer;
+ }
+
+ /**
+ * Deactivate listening to page selection events.
+ */
+ public void deactivateListeningToPageSelectionEvents() {
+ if (null != _selectionListener) {
+ getSite().getPage().removeSelectionListener(_selectionListener);
+ _selectionListener = null;
+ }
+ __isListeningToPageSelectionEvents = false;
+ }
+
+ /**
+ * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+ */
+ @Override
+ public void dispose() {
+ // Save view settings.
+ saveViewSettings();
+ deactivateListeningToPageSelectionEvents();
+ if (null != _propertySheetPage) {
+ _propertySheetPage.dispose();
+ _propertySheetPage = null;
+ }
+ if (null != _referencingViewer) {
+ removeListeners(_referencingViewer);
+ _referencingViewer = null;
+ }
+ if (null != _referencedViewer) {
+ removeListeners(_referencedViewer);
+ _referencedViewer = null;
+ }
+ if (null != _currentViewer) {
+ removeListeners(_currentViewer);
+ }
+ _viewerSelectionListener = null;
+ _viewerDoubleClickListener = null;
+ if (null != _history) {
+ _history.dispose();
+ _history = null;
+ }
+ // Unregister from monitored sessions.
+ Iterator<Entry<Session, SemClosedSessionListener>> iterator = _monitoredSessions.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<Session, SemClosedSessionListener> entry = iterator.next();
+ entry.getKey().removeListener(entry.getValue());
+ }
+ _monitoredSessions.clear();
+ _monitoredSessions = null;
+
+ model = null;
+ super.dispose();
+ }
+
+ /**
+ * @see org.eclipse.ui.navigator.CommonNavigator#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter_p) {
+ if (IPropertySheetPage.class.equals(adapter_p))
+ {
+ return getPropertySheetPage();
+ }
+ else
+ {
+ if (Control.class.equals(adapter_p))
+ return getParentControl();
+ }
+ return super.getAdapter(adapter_p);
+ }
+
+ /**
+ * @return the currentViewer
+ */
+ @Override
+ public TreeViewer getCurrentViewer() {
+ return _currentViewer;
+ }
+
+ /**
+ * Get dialog settings for this view.
+ * @return
+ */
+ private IDialogSettings getDialogSettingsSection() {
+ IDialogSettings dialogSettings = ExplorerContextualActivator.getDefault().getDialogSettings();
+ String sectionName = getClass().getName();
+ // Get the dialog setting for this view.
+ IDialogSettings section = dialogSettings.getSection(sectionName);
+ if (null == section) {
+ section = dialogSettings.addNewSection(sectionName);
+ }
+ return section;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart#getHistory()
+ */
+ @Override
+ public ExplorerHistory getHistory() {
+ if (null == _history) {
+ _history = new ExplorerHistory();
+ }
+ return _history;
+ }
+
+ /**
+ * Get parent control, if accessible.
+ * @return <code>null</code> if control could not be resolved.
+ */
+ protected Control getParentControl() {
+ if (null != _explorerContextualTitle) {
+ return _explorerContextualTitle.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * Gets the property sheet page.
+ */
+ protected TabbedPropertySheetPage getPropertySheetPage() {
+ if (null == _propertySheetPage) {
+ _propertySheetPage = new TabbedPropertySheetPage(this) {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void labelProviderChanged(LabelProviderChangedEvent event_p) {
+ if (!getControl().isDisposed()) {
+ super.labelProviderChanged(event_p);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage#refresh()
+ */
+ @Override
+ public void refresh() {
+ if (getCurrentTab() != null) {
+ super.refresh();
+ }
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void dispose() {
+ super.dispose();
+ _propertySheetPage = null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(IPageSite pageSite_p) {
+ super.init(pageSite_p);
+ pageSite_p.setSelectionProvider(ExplorerContextualView.this.getViewSite().getSelectionProvider());
+ }
+ };
+ }
+ return _propertySheetPage;
+ }
+
+ /**
+ * @return the referencedViewer
+ */
+ @Override
+ public TreeViewer getReferencedViewer() {
+ return _referencedViewer;
+ }
+
+ /**
+ * @return the referencingViewer
+ */
+ @Override
+ public TreeViewer getReferencingViewer() {
+ return _referencingViewer;
+ }
+
+ /**
+ * Get the current viewer root element.
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart#getRootElement()
+ */
+ @Override
+ public EObject getRootElement() {
+ return ((AbstractContentProvider) _currentViewer.getContentProvider()).getRootElement();
+ }
+
+ /**
+ * Get the selection listener to handle {@link IWorkbenchPage} selection events.
+ * @return
+ */
+ protected ISelectionListener getSelectionListener() {
+ return new ISelectionListener() {
+ /**
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void selectionChanged(IWorkbenchPart part_p, ISelection selection_p) {
+ Object newInput = handleWorkbenchPageSelectionEvent(part_p, selection_p);
+ // Set the selected object as new input only if it is an EObject
+ final String viewIDToIgnore = ingoredViewAsSelectionProvider();
+ if ((null != newInput) && (newInput instanceof EObject))
+ {
+ // Avoid the property view to be selection provider.
+ if (viewIDToIgnore != null &&viewIDToIgnore.equals(part_p.getSite().getId()))
+ {
+ //clean();
+ return;
+ }
+ // Check the input is different from current one.
+ try {
+ _shouldSetFocus = false;
+ setInput(newInput);
+ } finally {
+ _shouldSetFocus = true;
+ }
+ }
+ else
+ {
+ if (viewIDToIgnore != null && (part_p != ExplorerContextualView.this) &&
+ false == viewIDToIgnore.equals(part_p.getSite().getId()))
+ {
+ // Avoid the property view to be selection provider.
+ // Event sent by another part apart from the Property Sheet view
+ // Prevent from displaying elements not related to the workbench current selection.
+ clean();
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * Handle double click event in the viewpart.
+ * @param event_p
+ */
+ protected void handleDoubleClick(DoubleClickEvent event_p) {
+ ITreeSelection selection = (ITreeSelection) event_p.getSelection();
+ if (!selection.isEmpty())
+ {
+ Object doubleClickedElement = selection.getFirstElement();
+ // do nothing if element of the wrapper is the root element.
+ // change
+ if (doubleClickedElement instanceof ExplorerElementWrapper)
+ doubleClickedElement = ((ExplorerElementWrapper) doubleClickedElement).getElement();
+
+ // Handle an EObject double click event.
+ if (doubleClickedElement instanceof EObject)
+ {
+ if (_isCtrlKeyPressed)
+ handleDoubleClickWithCtrlKeyPressed(event_p, doubleClickedElement);
+ else
+ handleDoubleClickWithCtrlKeyNotPressed(event_p, doubleClickedElement);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void init(IViewSite site_p, IMemento memento_p) throws PartInitException {
+ // Specified memento could be null :
+ // 1) if the view was not shown when the previous workbench session
+ // exited.
+ // 2) the view is open by the end-user whereas the workbench is already
+ // loaded.
+ _memento = restoreViewSettings(memento_p);
+ super.init(site_p, _memento);
+ Integer value = null;
+ if (null != _memento) {
+ // Get state of listening to Page selection events.
+ value = _memento.getInteger(LISTENING_TO_WORKBENCH_PAGE_SELECTION_EVENTS);
+ }
+
+ boolean isListeningOnStartup =
+ !ExplorerContextualActivator.getDefault().getPreferenceStore().getBoolean(ExplorerContextualPreferences.PREFS_DISABLE_CONTEXTUAL_EXPLORER_SYNC_ON_STARTUP);
+ __isListeningToPageSelectionEvents = (null != value) ? value.intValue() == 1 : isListeningOnStartup;
+ }
+
+ /**
+ * Initialize a context menu for given viewer.
+ * @param menuManagerText_p
+ * @param menuManagerId_p
+ * @param viewer_p
+ */
+ private void initializeContextMenu(String menuManagerText_p, String menuManagerId_p, TreeViewer viewer_p) {
+ MenuManager menuManager = new MenuManager(menuManagerText_p, menuManagerId_p);
+ menuManager.setRemoveAllWhenShown(true);
+ Tree tree = viewer_p.getTree();
+ Menu currentMenu = menuManager.createContextMenu(tree);
+ tree.setMenu(currentMenu);
+ getSite().registerContextMenu(menuManager, viewer_p);
+ }
+
+ /**
+ * Initialize contextual menus of internal viewers.
+ */
+ private void initializeContextMenus() {
+ initializeContextMenu("current#PopupMenu", null, _currentViewer); //$NON-NLS-1$
+ initializeContextMenu("referenced#PopupMenu", null, _referencedViewer); //$NON-NLS-1$
+ initializeContextMenu("referencing#PopupMenu", null, _referencingViewer); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize given viewer with specified parameter.<br>
+ * The viewer layout data is set to a {@link GridData#FILL_BOTH}.
+ * @param viewer_p
+ * @param contentProvider_p
+ * @param labelProvider_p
+ * @param sorter_p
+ */
+ private void initializeViewer(TreeViewer viewer_p, IContentProvider contentProvider_p, IBaseLabelProvider labelProvider_p, ViewerSorter sorter_p) {
+ viewer_p.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ viewer_p.setContentProvider(contentProvider_p);
+ viewer_p.setLabelProvider(labelProvider_p);
+ viewer_p.setSorter(sorter_p);
+ }
+
+ /**
+ * @return the isCtrlKeyPressed
+ */
+ protected boolean isCtrlKeyPressed() {
+ return _isCtrlKeyPressed;
+ }
+
+ public ImageDescriptor getImageDescriptor(String key_p) {
+ ImageRegistry imageRegistry = ExplorerContextualActivator.getDefault().getImageRegistry();
+ ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(key_p);
+
+ if (null == imageDescriptor)
+ {
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(ExplorerContextualActivator.PLUGIN_ID, "icons/" + key_p);
+ imageRegistry.put(key_p, imageDescriptor);
+ }
+ return imageDescriptor;
+ }
+
+ protected IAction limitateTreeExpansionAction;
+
+ /**
+ * Make actions.
+ */
+ protected void makeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ // Add history actions.
+ _backAction = ExplorerActionFactory.BACKWARD_HISTORY.create(getViewSite().getWorkbenchWindow(), this);
+ _backAction.setActionDefinitionId("org.eclipse.amalgam.explorer.contextual.core.ui.backwardNavigation"); //$NON-NLS-1$
+ toolBarManager.add(_backAction);
+
+ _forwardAction = ExplorerActionFactory.FORWARD_HISTORY.create(getViewSite().getWorkbenchWindow(), this);
+ _forwardAction.setActionDefinitionId("org.eclipse.amalgam.explorer.contextual.core.ui.forwardNavigation"); //$NON-NLS-1$
+ toolBarManager.add(_forwardAction);
+
+ // Add limitate tree expansion action.
+ limitateTreeExpansionAction = new Action(null, IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ model.setLimitateTreeExpansion(isChecked());
+ Object input = getCurrentViewer().getInput();
+ setInputOnViewers(input);
+ }
+ };
+ limitateTreeExpansionAction.setChecked(model.doesLimitateTreeExpansion());
+ limitateTreeExpansionAction.setToolTipText(Messages.ExplorerContextualView_LimitateTreeExpansionAction_Tooltip);
+ limitateTreeExpansionAction.setImageDescriptor(getImageDescriptor(IImageKeys.IMG_COLLAPSE_CATEGORIES));
+ toolBarManager.add(limitateTreeExpansionAction);
+
+ // Add refresh action.
+ IAction refreshAction = new Action(null, getImageDescriptor(IImageKeys.IMG_REFRESH)) {
+ @Override
+ public void run() {
+ Object input = getCurrentViewer().getInput();
+ refreshTitleBar(input);
+ setInputOnViewers(input);
+ };
+ };
+ toolBarManager.add(refreshAction);
+
+ // Add the listening action (i.e button synch checked button).
+ IAction listeningToPageSelectionEventsAction = new Action(null, IAction.AS_CHECK_BOX) {
+ private ISelection getSelection(IWorkbenchPart part_p) {
+ return part_p.getSite().getSelectionProvider().getSelection();
+ }
+
+ private boolean isSomethingSelectable(ISelection selection) {
+ return (null != selection) && !selection.isEmpty();
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ if (isChecked())
+ {
+ activateListeningToPageSelectionEvents();
+ // Get the current selection.
+ IWorkbenchPage activePage = getSite().getPage();
+ // Get the active part to get something selectable.
+ IWorkbenchPart activePart = activePage.getActivePart();
+ IWorkbenchPart part = null;
+ ISelection selection = null;
+ if ((null != activePart) && (ExplorerContextualView.this != activePart))
+ {
+ // Handle selection at view creation time.
+ ISelectionProvider selectionProvider = activePart.getSite().getSelectionProvider();
+ if (null != selectionProvider) {
+ selection = selectionProvider.getSelection();
+ if (isSomethingSelectable(selection)) {
+ part = activePart;
+ }
+ }
+ }
+ else
+ {
+ String viewIDForSyncAction = getViewIDForSyncAction();
+ if (null != viewIDForSyncAction && false == viewIDForSyncAction.isEmpty())
+ {
+ IViewPart viewPart = activePage.findView(viewIDForSyncAction);
+ if (null != viewPart)
+ {
+ // The viewPart is displayed.
+ selection = getSelection(viewPart);
+ if (isSomethingSelectable(selection))
+ {
+ part = viewPart;
+ }
+ }
+ if (null == part)
+ {
+ // Try to get a selection from active editor.
+ IEditorPart activeEditor = activePage.getActiveEditor();
+ if (null != activeEditor)
+ {
+ selection = getSelection(activeEditor);
+ if (isSomethingSelectable(selection))
+ {
+ part = activeEditor;
+ }
+ }
+ }
+ }
+
+ }
+ if (null != part)
+ {
+ // Something to select.
+ _selectionListener.selectionChanged(part, selection);
+ }
+ }
+ else
+ {
+ deactivateListeningToPageSelectionEvents();
+ }
+ }
+ };
+
+ listeningToPageSelectionEventsAction.setText(Messages.ExplorerContextualView_ListeningToPageSelectionEventsAction_Title);
+ listeningToPageSelectionEventsAction.setToolTipText(Messages.ExplorerContextualView_ListeningToPageSelectionEventsAction_Tooltip);
+ listeningToPageSelectionEventsAction.setImageDescriptor(getImageDescriptor(IImageKeys.IMG_LISTENING_TO_PAGE_SELECTION_EVENTS));
+ toolBarManager.add(listeningToPageSelectionEventsAction);
+ // Restore state from boolean that keeps the state.
+ listeningToPageSelectionEventsAction.setChecked(__isListeningToPageSelectionEvents);
+ // If enable, listen to selection events.
+ if (__isListeningToPageSelectionEvents) {
+ // Run the action enables the listening and get the current
+ // selection.
+ listeningToPageSelectionEventsAction.run();
+ }
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart#refresh()
+ */
+ @Override
+ public void refresh() {
+ ViewerHelper.refresh(_referencingViewer);
+ ViewerHelper.refresh(_referencedViewer);
+ ViewerHelper.refresh(_currentViewer);
+ }
+
+ protected void refreshPropertyPage(ISelectionProvider selectionProvider_p) {
+ // Notify the property page to refresh with the new selection.
+ // Be careful, the properties view can be closed, don't send it
+ // selection changes.
+ IStructuredSelection selection = (IStructuredSelection) selectionProvider_p.getSelection();
+ if ((null != _propertySheetPage) && (!_propertySheetPage.getControl().isDisposed())) {
+ ISelectionProvider pageSelectionProvider = _propertySheetPage.getSite().getSelectionProvider();
+ if ((null == pageSelectionProvider) || (pageSelectionProvider != selectionProvider_p)) {
+ _propertySheetPage.getSite().setSelectionProvider(selectionProvider_p);
+ }
+ _propertySheetPage.selectionChanged(ExplorerContextualView.this, selection);
+ }
+ }
+
+ /**
+ * @param input_p
+ */
+ @SuppressWarnings("synthetic-access")
+ public void setInputOnViewers(final Object input_p) {
+ TreeViewer currentViewer = getCurrentViewer();
+
+ if ((currentViewer != null) && ((currentViewer.getControl() != null) && !(currentViewer.getControl().isDisposed()))) {
+ Display display = currentViewer.getControl().getDisplay();
+
+ BusyIndicator.showWhile(display, new Runnable() {
+ @Override
+ public void run() {
+
+ // Broadcast "set input" signal to all viewers.
+ ViewerHelper.run(_referencingViewer, new Runnable() {
+ @Override
+ public void run() {
+ if ((_referencingViewer.getControl() != null) && !_referencingViewer.getControl().isDisposed()) {
+ _referencingViewer.setInput(input_p);
+ }
+ }
+ });
+ ViewerHelper.run(_referencedViewer, new Runnable() {
+ @Override
+ public void run() {
+ if ((_referencedViewer.getControl() != null) && !_referencedViewer.getControl().isDisposed()) {
+ _referencedViewer.setInput(input_p);
+ }
+ }
+ });
+ ViewerHelper.run(_currentViewer, new Runnable() {
+ @Override
+ public void run() {
+ if ((_currentViewer.getControl() != null) && !_currentViewer.getControl().isDisposed()) {
+ _currentViewer.setInput(input_p);
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+
+ /**
+ * Return the title to display in the Contextual Explorer View depending on the selected element.
+ * @param object_p the selected element that is the current input of Contextual Explorer View
+ * @return A Title composed of <code>object_p</code> EClass name and <code>object_p</code> text as displayed in the view.
+ */
+ public static String getTitle(EObject object_p){
+ String title = AbstractLabelProviderFactory.getInstance().getCurrentLabelProvider().getText(object_p);
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) AdapterFactoryEditingDomain.getEditingDomainFor(object_p);
+ if (editingDomain != null)
+ {
+ IEditingDomainItemProvider provider = AdapterFactoryEditingDomain.getEditingDomainItemProviderFor(object_p);
+ if (provider instanceof ItemProviderAdapter)
+ {
+ EClass eClass = object_p.eClass();
+ try {
+ String className = ((ItemProviderAdapter)provider).getString("_UI_" + eClass.getName() + "_type");
+ if (null != className &&
+ false == className.isEmpty())
+ {
+ className = "[" + className + "]";
+ }
+
+ if (false == title.equals(className))
+ {
+ title = className + " "+ title;
+ }
+ }
+ catch (MissingResourceException e) {
+ }
+ }
+ }
+
+ return title;
+ }
+
+ /**
+ * Updates the title bar.
+ */
+ protected void refreshTitleBar(Object selectedElement_p) {
+ String title = Messages.ExplorerContextualView_Default_Name;
+ Image image = null;
+ if (null != selectedElement_p) {
+ // Get title to display
+ title = getTitle((EObject) selectedElement_p);
+
+ // The image to display
+ image = AbstractLabelProviderFactory.getInstance().getCurrentLabelProvider().getImage(selectedElement_p);
+ }
+
+ if (!_explorerContextualTitle.isDisposed())
+ {
+ _explorerContextualTitle.setRedraw(false);
+ _explorerContextualTitle.setTitle(title, image);
+ _explorerContextualTitle.setRedraw(true);
+ }
+ }
+
+ /**
+ * Remove listeners registered on given viewer.
+ */
+ protected void removeListeners(TreeViewer viewer_p) {
+ viewer_p.removeDoubleClickListener(_viewerDoubleClickListener);
+ viewer_p.removeSelectionChangedListener(_viewerSelectionListener);
+ }
+
+ /**
+ * Restore view settings.
+ */
+ private IMemento restoreViewSettings(IMemento memento_p) {
+ IMemento memento_l = memento_p;
+ // Specified memento is null, let's get it from view settings
+ // persistence.
+ if (null == memento_l) {
+ // Indeed, if the view was not shown when the previous workbench
+ // session exited, no memento is provided.
+ // The only chance to restore current state is to get the memento
+ // from its persisted representation in view settings (if any).
+ String persistedMemento = _viewSettings.get(TAG_MEMENTO);
+ if (null != persistedMemento) {
+ try {
+ memento_l = XMLMemento.createReadRoot(new StringReader(persistedMemento));
+ } catch (WorkbenchException exception_p) {
+ // Don't do anything. Simply don't restore the settings
+ }
+ }
+ }
+ return memento_l;
+ }
+
+ /**
+ * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento memento_p) {
+ memento_p.putInteger(LISTENING_TO_WORKBENCH_PAGE_SELECTION_EVENTS, __isListeningToPageSelectionEvents ? 1 : 0);
+ }
+
+ /**
+ * Save the dialog settings for this view.
+ */
+ private void saveViewSettings() {
+ String rootName = getClass().getSimpleName();
+ // Create a new memento.
+ XMLMemento memento = XMLMemento.createWriteRoot(rootName);
+ // Save current state in it.
+ // Notice, that the saveState() method is also called by the workbench
+ // when exiting before the dispose() method.
+ // Nevertheless, we keep this call here, to make sure current state is
+ // stored within a running workbench session where the saveState()
+ // method is not called.
+ saveState(memento);
+ StringWriter writer = new StringWriter();
+ try {
+ memento.save(writer);
+ _viewSettings.put(TAG_MEMENTO, writer.getBuffer().toString());
+ } catch (IOException exception_p) {
+ // Don't do anything. Simply don't store the settings
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ ISelectionProvider selectionProvider = _delegateSelectionProvider.getDelegate();
+ // Make sure the selection provider is tree viewer.
+ if ((null != selectionProvider) && (selectionProvider instanceof TreeViewer)) {
+ ((TreeViewer) selectionProvider).getControl().setFocus();
+ } else {
+ _currentViewer.getControl().setFocus();
+ }
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.view.IExplorerContextualViewPart#setInput(java.lang.Object)
+ */
+ @Override
+ public void setInput(final Object input_p) {
+ // Precondition: do not set the same input twice.
+ TreeViewer currentViewer = getCurrentViewer();
+ Object lastInput = currentViewer.getInput();
+ if ((null != lastInput) && (lastInput.equals(input_p))) {
+ return;
+ }
+ refreshTitleBar(input_p);
+ // Set the selection provider with currentViewer as selection provider.
+ _delegateSelectionProvider.setDelegate(_currentViewer);
+
+ // Broadcast "set input" signal to all viewers.
+ setInputOnViewers(input_p);
+
+ onSetNewInput((EObject) input_p, (EObject) lastInput);
+
+ // Update history mechanism.
+ getHistory().update(input_p);
+ // Force to reset the focus and the underlying selection provider.
+ // From platform selection changed event, the setFocus is disabled.
+ if (_shouldSetFocus)
+ {
+ // Set focus in another thread UI processing.
+ setFocus();
+ }
+ // Monitor session closing event to clean the Contextual Explorer.
+ if (input_p instanceof EObject)
+ {
+ monitorSessionClosingEvent((EObject) input_p);
+ }
+ }
+
+ /**
+ * Update the view site selection provider with specified one.
+ * @param newSelectionProvider_p
+ */
+ protected void updateSelectionProvider(ISelectionProvider newSelectionProvider_p) {
+ // Set the selection provider if necessary.
+ ISelectionProvider currentSelectionProvider = _delegateSelectionProvider.getDelegate();
+ if ((null == currentSelectionProvider) || (currentSelectionProvider != newSelectionProvider_p)) {
+ _delegateSelectionProvider.setDelegate(newSelectionProvider_p);
+ }
+ }
+
+ /**
+ * Is Contextual Explorer listening to {@link IWorkbenchPage} selection events.
+ * @return the isListeningToPageSelectionEvents
+ */
+ public static boolean isListeningToPageSelectionEvents() {
+ return __isListeningToPageSelectionEvents;
+ }
+
+
+ /**
+ * Handle workbench page selection events.<br>
+ * @param part_p
+ * @param selection_p
+ * @return <code>null</code> means no element found from selection.
+ */
+ protected Object handleWorkbenchPageSelectionEvent(IWorkbenchPart part_p, ISelection selection_p){
+ Object result = null;
+ if (!selection_p.isEmpty() && !(part_p instanceof ExplorerContextualView))
+ {
+ if (selection_p instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection_l = (IStructuredSelection) selection_p;
+ Object firstElement = selection_l.getFirstElement();
+ result = SelectionHelpersManager.getInstance().getSelection(part_p, selection_p, firstElement);
+ }
+ }
+
+ return result;
+ }
+
+ /**********************************************************************************************/
+ /******************************* new methods **************************************************/
+ /**********************************************************************************************/
+
+ /**
+ * This log an error message in the console. Derived classes can use their own way to log errors
+ * @param message the error message to log
+ * @param throwable the {@link Throwable}
+ */
+ public void logError(String message, Throwable throwable){
+ final Logger _logger = Logger.getLogger(ExplorerActivator.PLUGIN_ID);
+ _logger.error(message.toString(), throwable);
+ }
+
+ /**
+ * Derived classes can't change this method behavior.
+ *
+ * When Ctrl key is pressed and when user double click on an element, so this element is used as
+ * new input for Contextual Explorer
+ * @param event_p the {@link DoubleClickEvent} event
+ * @param object_p the double clicked element
+ */
+ protected final void handleDoubleClickWithCtrlKeyPressed(DoubleClickEvent event_p, Object object_p){
+ if (getRootElement() != object_p)
+ {
+ // CTRL is pressed, let's navigate...
+ setInput(object_p);
+ // Set and reveal the focused element.
+ _currentViewer.setSelection(new StructuredSelection(object_p), true);
+ }
+ }
+
+ /**
+ * By default, Contextual Explorer Contributor ID is used, but derived classes can use their own contributor ID.
+ */
+ @Override
+ public String getContributorId() {
+ return EXPLORER_CONTEXTUAL_CONTRIBUTOR_ID;
+ }
+
+ /**
+ * Allows to do action when Ctrl key is'nt pressed and user double click on one element.
+ * @param event_p The {@link DoubleClickEvent} Event
+ * @param object_p concerned element
+ */
+ protected void handleDoubleClickWithCtrlKeyNotPressed(DoubleClickEvent event_p, Object object_p){
+ // Nothing to do
+ // Derived classes can implement this method.
+ }
+
+ /**
+ * Custom actions to do when Contextual Explorer input element changes
+ * @param input_p the new input
+ * @param lastInput_p the previous input
+ */
+ protected void onSetNewInput(Object input_p, Object lastInput_p){
+ // Nothing to do
+ // Derived classes can implement this method.
+ }
+
+ public abstract boolean isSemanticElements(Collection<?> objects_p);
+
+ /**
+ * The ID of the view to synchronize with Contextual Explorer selection change
+ * @return the view ID
+ */
+ protected abstract String getViewIDForSyncAction();
+
+ /**
+ * The ID of the view to ignore when listening to selection changes
+ * @return the view ID
+ */
+ protected abstract String ingoredViewAsSelectionProvider();
+
+
+ /******/
+ class SemClosedSessionListener extends ClosedSessionListener {
+ /**
+ * Constructor.
+ * @param session_p
+ */
+ public SemClosedSessionListener(Session session_p) {
+ super(session_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void handleClosedSession(Session monitoredSession_p) {
+ super.handleClosedSession(monitoredSession_p);
+ // Update history to clean dead entries.
+ getHistory().update(null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void handleClosingSession(Session monitoredSession_p) {
+ Object currentInput = getCurrentViewer().getInput();
+ if (currentInput instanceof EObject) {
+ // Get the session of current displayed object.
+ Session session = SessionManager.INSTANCE.getSession((EObject) currentInput);
+ if (monitoredSession_p.equals(session)) {
+ clean();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/IExplorerContextualViewPart.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/IExplorerContextualViewPart.java
new file mode 100644
index 0000000..5705688
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/IExplorerContextualViewPart.java
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.ExplorerHistory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.IViewPart;
+
+/**
+ * A Contextual Explorer view part contains multiple viewers.
+ * The viewers have the same current element which is root element.
+ * This interface gives an access to the root element.
+ */
+public interface IExplorerContextualViewPart extends IViewPart {
+
+ /**
+ * Launch an action contextual to the given element.
+ * Like : setting the input of every viewers referenced by the viewpart.
+ * @param input_p
+ */
+ void setInput(Object input_p);
+
+ /**
+ * Retrieve element root (current element to whole viewers contained by the viewpart)
+ * @return
+ */
+ EObject getRootElement ();
+
+ /**
+ * Refresh content of the viewpart.
+ */
+ void refresh();
+
+ /**
+ * Clean the content of the viewpart.
+ */
+ void clean();
+
+ /**
+ * @return the referencingViewer
+ */
+ public TreeViewer getReferencingViewer();
+
+ /**
+ * @return the currentViewer
+ */
+ public TreeViewer getCurrentViewer();
+
+ /**
+ * @return the referencedViewer
+ */
+ public TreeViewer getReferencedViewer();
+
+ /**
+ * @return
+ */
+ public ExplorerHistory getHistory();
+
+ public IExplorerContextualModel getModel();
+
+ public void setInputOnViewers(Object input_p);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/Messages.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/Messages.java
new file mode 100644
index 0000000..cc4f5ca
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/Messages.java
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * I18n support.
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.amalgam.explorer.contextual.core.ui.view.messages"; //$NON-NLS-1$
+ /**
+ * Text of the label for Current Elements explorer.
+ */
+ public static String ExplorerContextualView_Current_Element_Title;
+ /**
+ * The default title name for the Contextual Explorer. This title is displayed when no element is selected.
+ */
+ public static String ExplorerContextualView_Default_Name;
+ public static String ExplorerContextualView_ListeningToPageSelectionEventsAction_Title;
+ public static String ExplorerContextualView_ListeningToPageSelectionEventsAction_Tooltip;
+ public static String ExplorerContextualView_ShowPatternsAction_Tooltip;
+ public static String ExplorerContextualView_ShowDiagramsAction_Tooltip;
+ public static String ExplorerContextualView_LimitateTreeExpansionAction_Tooltip;
+
+ /**
+ * Text of the label for Referenced Elements explorer.
+ */
+ public static String ExplorerContextualView_Referenced_Elements_Title;
+ public static String ExplorerContextualView_Referencing_Elements_Title;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do nothing.
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/TreeItemListenerForHistory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/TreeItemListenerForHistory.java
new file mode 100644
index 0000000..35b4179
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/TreeItemListenerForHistory.java
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view;
+
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryImpl;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+public class TreeItemListenerForHistory implements Listener {
+
+ protected boolean hasBeenExpanded;
+ protected String explorerID;
+ protected IExplorerContextualModel model;
+ protected ExplorerContextualTree explorer;
+
+ public TreeItemListenerForHistory(boolean hasBeenExpanded_p, String explorerID_p, IExplorerContextualModel model_p, ExplorerContextualTree explorer_p) {
+ hasBeenExpanded = hasBeenExpanded_p;
+ explorerID = explorerID_p;
+ model = model_p;
+ explorer = explorer_p;
+ }
+
+ @Override
+ public void handleEvent(Event e) {
+ if (!model.containsExpandedHistory(explorerID)) {
+ explorer.initializeHistory();
+ }
+ Widget widget = e.item;
+ if (widget instanceof TreeItem) {
+ TreeItem item = (TreeItem) widget;
+ Object data = item.getData();
+ if ((data != null) && (data instanceof CategoryWrapper)) {
+ CategoryImpl category = (CategoryImpl) ((CategoryWrapper) data).getElement();
+ model.saveExpandedState(category, explorerID, hasBeenExpanded);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/ISelectionHelper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/ISelectionHelper.java
new file mode 100644
index 0000000..d9466aa
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/ISelectionHelper.java
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view.ext;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ *
+ */
+public interface ISelectionHelper {
+
+ /**
+ * Provide a list of object to handle by the Contextual Explorer
+ * @param part_p
+ * @param selection_p
+ * @param selectedObject
+ * @return
+ */
+ public Object getSelection(IWorkbenchPart part_p, ISelection selection_p, Object selectedObject);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/SelectionHelpersManager.java b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/SelectionHelpersManager.java
new file mode 100644
index 0000000..e3ac286
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/ext/SelectionHelpersManager.java
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ui.view.ext;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.amalgam.explorer.contextual.core.ui.ExplorerContextualActivator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ *
+ */
+public class SelectionHelpersManager extends AbstractExtensionPointManager implements ISelectionHelper{
+
+ /** Singleton property **/
+ private static SelectionHelpersManager _instance ;
+
+ /** Selection helper configuration element name**/
+ private static final String _SELECTION_HELPER = "selectionHelper";
+
+ /** Selection Helper registry **/
+ private Map<String, ISelectionHelper> _extensions ;
+
+ /**
+ * Singleton method.
+ * @return Unique {@link SelectionHelpersManager} instance
+ */
+ public static SelectionHelpersManager getInstance() {
+ if (null == _instance)
+ _instance = new SelectionHelpersManager();
+
+ return _instance;
+ }
+
+ /**
+ * Hidden constructor.
+ */
+ private SelectionHelpersManager() {
+ _extensions = new HashMap<String, ISelectionHelper>();
+ initExtensionRegistry();
+ }
+
+ /**
+ * Handle the selection element.
+ */
+ @Override
+ public Object getSelection(IWorkbenchPart part_p, ISelection selection_p, Object selectedObject) {
+ Object result = null;
+
+ if (false == _extensions.isEmpty())
+ {
+ for (ISelectionHelper iSelectionHelper : _extensions.values())
+ {
+ Object selection = iSelectionHelper.getSelection(part_p, selection_p, selectedObject);
+ if (null != selection)
+ {
+ result = selection;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Load all Selection helpers
+ */
+ public void initExtensionRegistry(){
+ IConfigurationElement[] confElements =
+ getConfigurationElementsFor(ExplorerContextualActivator.PLUGIN_ID, _SELECTION_HELPER);
+
+ for (IConfigurationElement iConfigurationElement : confElements)
+ {
+ String id = iConfigurationElement.getAttribute(DEFAULT_ID_ATTRIBUTE);
+ ISelectionHelper helper = createTypedInstance(iConfigurationElement, DEFAULT_CLASS_ATTRIBUTE, ISelectionHelper.class);
+
+ if (false == _extensions.containsKey(id))
+ {
+ _extensions.put(id, helper);
+ }
+ else
+ {
+ String message = "Many Selection helpers share id : " + id;
+ Status status = new Status(IStatus.WARNING, ExplorerContextualActivator.PLUGIN_ID, message);
+ ExplorerContextualActivator.getDefault().getLog().log(status);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/messages.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/messages.properties
new file mode 100644
index 0000000..6c5fa2e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core.ui/src/org/eclipse/amalgam/explorer/contextual/core/ui/view/messages.properties
@@ -0,0 +1,20 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+ExplorerContextualView_Current_Element_Title=Current Element
+ExplorerContextualView_Default_Name=Contextual Explorer not available
+ExplorerContextualView_ListeningToPageSelectionEventsAction_Title=Listen to Workbench Selection
+ExplorerContextualView_ListeningToPageSelectionEventsAction_Tooltip=Link content to workbench selection events
+ExplorerContextualView_ShowPatternsAction_Tooltip=Show pattern instances in the Contextual Explorer
+ExplorerContextualView_ShowDiagramsAction_Tooltip=Show diagrams in the Contextual Explorer
+ExplorerContextualView_LimitateTreeExpansionAction_Tooltip=Limit the expansion of tree
+ExplorerContextualView_Referenced_Elements_Title=Referenced Elements
+ExplorerContextualView_Referencing_Elements_Title=Referencing Elements
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/.classpath b/plugins/org.eclipse.amalgam.explorer.contextual.core/.classpath
new file mode 100644
index 0000000..b1dabee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/.project b/plugins/org.eclipse.amalgam.explorer.contextual.core/.project
new file mode 100644
index 0000000..2b195dd
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.amalgam.explorer.contextual.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.contextual.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..76b8ed8
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.amalgam.explorer.contextual.core;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator
+Require-Bundle: org.apache.log4j;visibility:=reexport,
+ org.eclipse.emf.transaction.ui;visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.amalgam.explorer.contextual.core,
+ org.eclipse.amalgam.explorer.contextual.core.category,
+ org.eclipse.amalgam.explorer.contextual.core.ext,
+ org.eclipse.amalgam.explorer.contextual.core.filter,
+ org.eclipse.amalgam.explorer.contextual.core.internal,
+ org.eclipse.amalgam.explorer.contextual.core.model,
+ org.eclipse.amalgam.explorer.contextual.core.provider,
+ org.eclipse.amalgam.explorer.contextual.core.provider.impl,
+ org.eclipse.amalgam.explorer.contextual.core.provider.util,
+ org.eclipse.amalgam.explorer.contextual.core.provider.wrapper,
+ org.eclipse.amalgam.explorer.contextual.core.query,
+ org.eclipse.amalgam.explorer.contextual.core.query.impl,
+ org.eclipse.amalgam.explorer.contextual.core.util
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/about.html b/plugins/org.eclipse.amalgam.explorer.contextual.core/about.html
new file mode 100644
index 0000000..c9aa915
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/build.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core/build.properties
new file mode 100644
index 0000000..9fa7f61
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/build.properties
@@ -0,0 +1,20 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties,\
+ icons/,\
+ schema/
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/license.txt b/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/license.txt
new file mode 100644
index 0000000..e22c5a1
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/license.txt
@@ -0,0 +1,7 @@
+These followings icons are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+<icon file path> - <original eclipse plug-in> - <original file path>
+
+/icons/packd_obj.gif - org.eclipse.jdt.ui - org.eclipse.jdt.ui/icons/full/elcl16/th_showqualified.gif
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/packd_obj.gif b/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/packd_obj.gif
new file mode 100644
index 0000000..2556b45
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/icons/packd_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.properties
new file mode 100644
index 0000000..2bf881c
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.properties
@@ -0,0 +1,13 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+#Properties file for org.eclipse.amalgam.explorer.contextual.core
+pluginName=Amalgam Contextual Explorer Core (Incubation)
+providerName=www.eclipse.org
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.xml b/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.xml
new file mode 100644
index 0000000..9b83bf0
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="contentProviderFactory" name="Content Provider Factory" schema="schema/contentProviderFactory.exsd"/>
+ <extension-point id="contentProviderCategory" name="Content Provider Category" schema="schema/contentProviderCategory.exsd"/>
+ <extension-point id="labelProviderFactory" name="Label Provider Factory" schema="schema/labelProviderFactory.exsd"/>
+ <extension-point id="candidateElementFilter" name="candidate Element Filter" schema="schema/candidateElementFilter.exsd"/>
+ <extension-point id="customQueryExecutionManager" name="custom Query Execution Manager" schema="schema/customQueryExecutionManager.exsd"/>
+</plugin>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/candidateElementFilter.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/candidateElementFilter.exsd
new file mode 100644
index 0000000..d468721
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/candidateElementFilter.exsd
@@ -0,0 +1,136 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core" id="candidateElementFilter" name="candidateElementFilter"/>
+ </appInfo>
+ <documentation>
+ This extension point allows defining filter on elements to display or hide in the Contextual Explorer.
+
+Each filter is applyed if it pre-condition is evaluated as True.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="filter"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <complexType>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.amalgam.explorer.contextual.core.filter.ICandidateElementFilter"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderCategory.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderCategory.exsd
new file mode 100644
index 0000000..faba7cb
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderCategory.exsd
@@ -0,0 +1,284 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core" id="content.provider.category" name="Content Provider Category"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ <documentation>
+ This extension allows to declare 1 or more Category for contributing to the Explorer Contextual.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="category" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <annotation>
+ <documentation>
+ Define a category of a contextual explorer.
+A category is composed of :
+- an id
+- a class type for which the category is available
+- a set of viewers (targetExplorers) where the category will be docked.
+- a set of sub categories referenced by Id.
+- a set of queries associated to this category
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="1">
+ <element ref="availableForType"/>
+ <element ref="targetExplorerId"/>
+ <element ref="subCategories"/>
+ <element ref="categoryQuery"/>
+ <element ref="itemQueries"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ An id which allows to order categories & to reference each other.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isTopLevel" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="availableForType">
+ <annotation>
+ <documentation>
+ Category is available only if the current element type matches the specified type & target exporer matches.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.emf.ecore.impl.EObjectImpl:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="targetExplorerId">
+ <annotation>
+ <documentation>
+ Category is available only if the current element type matches the specified type & target explorer matches.
+A Category can be displayed in several explorers.
+An explorer is associated to 1 kind among the following list :
+- CurrentElementExplorer : explorer of the element that has just been dble-clicked.
+- ReferencedElementExplorer : explorer of the elements that refer to the current element.
+- ReferencingElementExplorer : explorer of the elements that current element is referencing to.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" use="required">
+ <annotation>
+ <documentation>
+ Id is restricted to the following choices :
+- CurrentElementExplorer : explorer of the element that has just been dble-clicked.
+- ReferencedElementExplorer : explorer of the elements that refer to the current element.
+- ReferencingElementExplorer : explorer of the elements that current element is referencing to.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="CurrentElementExplorer">
+ </enumeration>
+ <enumeration value="ReferencingElementExplorer">
+ </enumeration>
+ <enumeration value="ReferencedElementExplorer">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="subCategories">
+ <annotation>
+ <documentation>
+ A sub category is a referenced to a category.
+A sub category is identified by an string id.
+At this time, no compliancy control is applied to detect cycle between categories.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="1">
+ <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="categoryQuery">
+ <annotation>
+ <documentation>
+ The content of a category results from the computation of a query.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="basicQuery"/>
+ <element ref="navigationQuery"/>
+ </choice>
+ </complexType>
+ </element>
+
+ <element name="itemQueries">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <choice>
+ <element ref="basicQuery" minOccurs="0" maxOccurs="1"/>
+ <element ref="navigationQuery" minOccurs="0" maxOccurs="1"/>
+ </choice>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="basicQuery">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.amalgam.explorer.contextual.core.query.IQuery"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="navigationQuery">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.polarsys.capella.common.mdsofa.dsl.navigation.instance.IDSLInstanceNavigationQuery"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderFactory.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderFactory.exsd
new file mode 100644
index 0000000..7b0238d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/contentProviderFactory.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core" id="content.provider.factory" name="Content Provider Factory"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="contentProviderFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contentProviderFactory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProviderFactory:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/customQueryExecutionManager.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/customQueryExecutionManager.exsd
new file mode 100644
index 0000000..a44b6ae
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/customQueryExecutionManager.exsd
@@ -0,0 +1,137 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core" id="customQueryExecutionManager" name="customQueryExecutionManager"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="manager"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="manager">
+ <complexType>
+ <attribute name="queryClass" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="java.lang.Object:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="customExecutionManager" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.amalgam.explorer.contextual.core.query.ICustomQueryExecutionManager"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/labelProviderFactory.exsd b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/labelProviderFactory.exsd
new file mode 100644
index 0000000..acbb623
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/schema/labelProviderFactory.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual.core" id="labelProviderFactory" name="Label Provider Factory"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="labelProviderFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="labelProviderFactory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.amalgam.explorer.contextual.core.provider.AbstractLabelProviderFactory:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ExplorerActivator.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ExplorerActivator.java
new file mode 100644
index 0000000..58833ff
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ExplorerActivator.java
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ExplorerActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.amalgam.explorer.contextual.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static ExplorerActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public ExplorerActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ExplorerActivator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryImpl.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryImpl.java
new file mode 100644
index 0000000..6dfa176
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryImpl.java
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.category;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.internal.TypeHelper;
+import org.eclipse.amalgam.explorer.contextual.core.query.impl.QueryAdapter;
+
+/**
+ * Category implementation. POJO representing an entry in extension content.provider.category
+ */
+public class CategoryImpl implements ICategory {
+ /**
+ * Qualified Name of type for which the category is enabled.
+ */
+ protected String qualifiedName = null;
+
+ /**
+ * This list contains ids of sub categories of this category.
+ */
+ protected List<String> subCategoriesIds = null;
+
+ /**
+ * Query associated to this category.
+ */
+ protected Object categoryQuery = null;
+
+ /**
+ * Item Queries associated to the upcoming content of this category.
+ */
+ protected List<Object> itemQueries = null;
+
+ /**
+ * Category ID.
+ */
+ protected String id = null;
+
+ /**
+ * Category Name.
+ */
+ protected String name = null;
+
+ /**
+ * If true, means category is a direct child of the root element.
+ */
+ protected boolean isTopLevel = false;
+
+ /**
+ * Item Queries of the category.
+ */
+ protected HashSet<Object> itemQueriesHashSet = null;
+
+ /**
+ * Constructor.
+ */
+ public CategoryImpl() {
+ subCategoriesIds = new ArrayList<String>(0);
+ itemQueries = new ArrayList<Object>(0);
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#isAvailableForType(java.lang.Object)
+ */
+ public boolean isAvailableForType(Object element_p) {
+ return TypeHelper.getInstance().isInstanceOf(element_p, qualifiedName);
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#setId(java.lang.String)
+ */
+ public void setId(String id_p) {
+ id = id_p;
+ }
+
+ /**
+ * Add an id to the sub categories id list.
+ * @param id_p
+ */
+ public void addSubCategoryId(String id_p) {
+ if (id_p != null && !id_p.isEmpty())
+ subCategoriesIds.add(id_p);
+ }
+
+ /**
+ * Add a category
+ */
+ public void setQuery(Object query_p) {
+ categoryQuery = query_p;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#setTypeFullyQualifiedName(java.lang.String)
+ */
+ public void setTypeFullyQualifiedName(String element_p) {
+ qualifiedName = element_p;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#getSubCategoryIds()
+ */
+ public List<String> getSubCategoryIds() {
+ return subCategoriesIds;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#compute()
+ */
+ public List<Object> compute(Object currentElement_p) {
+ return QueryAdapter.getInstance().compute(currentElement_p, categoryQuery);
+ }
+
+ /**
+ * @param name_p the name to set
+ */
+ public void setName(String name_p) {
+ name = name_p;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#setIsTopLevel(boolean)
+ */
+ public void setIsTopLevel(boolean isTopLevel_p) {
+ // if redefined by different extensions, return (A or... Z)
+ isTopLevel |= isTopLevel_p;
+ }
+
+ /**
+ * Return true if Category is root category.
+ * @return
+ */
+ public boolean isTopLevel() {
+ return isTopLevel;
+ }
+
+ /**
+ * @see org.eclipse.amalgam.explorer.contextual.core.category.ICategory#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the itemQueries
+ */
+ public List<Object> getItemQueries() {
+ return itemQueries;
+ }
+
+ /**
+ * @param itemQueries_p the itemQueries to set
+ */
+ public void addItemQuery(Object query) {
+ if (query != null)
+ itemQueries.add(query);
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryRegistry.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryRegistry.java
new file mode 100644
index 0000000..5e572bd
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/CategoryRegistry.java
@@ -0,0 +1,241 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.category;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.amalgam.explorer.contextual.core.provider.IExplorerContentProvider;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Category Registry. Responsibility of initialize and cache all categories on loading. Gathering categories in session.
+ */
+public class CategoryRegistry extends AbstractExtensionPointManager{
+ /**
+ * Singleton.
+ */
+ protected static CategoryRegistry _categoryRegistry = null;
+ private static final String CONTENT_PROVIDER_CATEGORY = Messages.getString("CategoryRegistry.ContentProvider"); //$NON-NLS-1$
+ /**
+ * Cache of category
+ */
+ protected List<ICategory> categoriesCache = new ArrayList<ICategory>(0);
+ /**
+ * CategoryMap<Category Id, Category>
+ */
+ protected HashMap<String, ICategory> currentElementRegistry = null;
+ protected HashMap<String, ICategory> diagramElementRegistry = null;
+
+ protected HashMap<String, ICategory> referencedElementRegistry = null;
+
+ protected HashMap<String, ICategory> referencingElementRegistry = null;
+
+ /**
+ * Singleton constructor.
+ */
+ private CategoryRegistry() {
+ initRegister();
+ }
+
+ /**
+ * @param viewerId_p
+ * @param currentElement_p
+ * @return
+ */
+ public Set<ICategory> gatherCategories(String viewerId_p, EObject currentElement_p) {
+ Set<ICategory> result = gatherCategoriesInternal(currentElement_p, getRegistry(viewerId_p));
+ return result;
+ }
+
+ /**
+ * @param currentElement_p_p
+ * @param viewerId_p_p
+ * @param elementRegistry_p
+ * @return
+ */
+ private Set<ICategory> gatherCategoriesInternal(Object element_p, HashMap<String, ICategory> elementRegistry_p) {
+ Set<ICategory> categories = new HashSet<ICategory>(0);
+ Set<Entry<String, ICategory>> entrySet = elementRegistry_p.entrySet();
+ for (Entry<String, ICategory> entry : entrySet) {
+ ICategory category = entry.getValue();
+ // type matching.
+ if (category.isAvailableForType(element_p)) {
+ // top level category.
+ if (category.isTopLevel()) {
+ categories.add(category);
+ }
+ }
+ }
+ return categories;
+ }
+
+ /**
+ * @param viewerId_p
+ * @param category_p
+ * @return
+ */
+ public List<ICategory> gatherSubCategories(String viewerId_p, EObject currentElement_p, ICategory category_p) {
+ List<ICategory> result = gatherSubCategoriesInternal(currentElement_p, category_p, getRegistry(viewerId_p));
+ return result;
+ }
+
+ /**
+ * @param category_p
+ * @param elementRegistry_p
+ * @param categories
+ * @param category
+ */
+ private List<ICategory> gatherSubCategoriesInternal(Object element_p, ICategory category_p, HashMap<String, ICategory> elementRegistry_p) {
+ List<ICategory> subCategories = new ArrayList<ICategory>(0);
+ for (String subCategoryId : category_p.getSubCategoryIds()) {
+ ICategory subCategory = elementRegistry_p.get(subCategoryId);
+ if ((subCategory != null) && subCategory.isAvailableForType(element_p)) {
+ subCategories.add(subCategory);
+ }
+ }
+ return subCategories;
+ }
+
+ protected HashMap<String, ICategory> getRegistry(String viewerId_p) {
+ if (viewerId_p.equalsIgnoreCase(IExplorerContentProvider.ID_CURRENT_CP)) {
+ return currentElementRegistry;
+ } else if (viewerId_p.equalsIgnoreCase(IExplorerContentProvider.ID_REFERENCED_CP)) {
+ return referencedElementRegistry;
+ } else if (viewerId_p.equalsIgnoreCase(IExplorerContentProvider.ID_REFERENCING_CP)) {
+ return referencingElementRegistry;
+ } else {// ID_DIAGRAM_CP Statement.
+ return diagramElementRegistry;
+ }
+ }
+
+ /**
+ * Initialize Register. One shot initialization. Spread the categories among right register.
+ */
+ private void initRegister() {
+ currentElementRegistry = new HashMap<String, ICategory>(0);
+ referencedElementRegistry = new HashMap<String, ICategory>(0);
+ referencingElementRegistry = new HashMap<String, ICategory>(0);
+ diagramElementRegistry = new HashMap<String, ICategory>(0);
+
+ IConfigurationElement[] categories = getConfigurationElementsFor(ExplorerActivator.PLUGIN_ID, CONTENT_PROVIDER_CATEGORY);
+
+ for (IConfigurationElement categoryConfigurationElement : categories) {
+ // Create simple instance of category
+ ICategory category = new CategoryImpl();
+
+ /**
+ * Fill category
+ */
+ // Retrieve id attribute.
+ String categoryId = categoryConfigurationElement.getAttribute(DEFAULT_ID_ATTRIBUTE);
+ category.setId(categoryId);
+
+ // Retrieve name attribute.
+ String categoryName = categoryConfigurationElement.getAttribute(DEFAULT_NAME_ATTRIBUTE);
+ category.setName(categoryName);
+
+ // Retrieve isTopLevel attribute.
+ String isTopLevelCategory = categoryConfigurationElement.getAttribute(Messages.getString("CategoryRegistry.TopLevel")); //$NON-NLS-1$
+ if ((isTopLevelCategory != null) && (isTopLevelCategory != "")) { //$NON-NLS-1$
+ category.setIsTopLevel(Boolean.parseBoolean(isTopLevelCategory));
+ } else {
+ category.setIsTopLevel(false);
+ }
+
+ // Retrieve sub categories ids.
+ IConfigurationElement[] subCategoriesNodes = categoryConfigurationElement.getChildren(Messages.getString("CategoryRegistry.SubCategory")); //$NON-NLS-1$
+ if (subCategoriesNodes.length > 0) {
+ IConfigurationElement[] subCategoryConfigurationElements = subCategoriesNodes[0].getChildren(Messages.getString("CategoryRegistry.Category")); //$NON-NLS-1$
+ for (IConfigurationElement subCategoryConfigurationElement : subCategoryConfigurationElements) {
+ // retrieve the id attribute and add it in the category.
+ category.addSubCategoryId(subCategoryConfigurationElement.getAttribute(DEFAULT_ID_ATTRIBUTE));
+ }
+ }
+
+ // Retrieve item queries
+ IConfigurationElement[] itemQueriesNode = categoryConfigurationElement.getChildren(Messages.getString("ItemQueries")); //$NON-NLS-1$
+ if (itemQueriesNode.length > 0) {
+ IConfigurationElement[] itemQueries = itemQueriesNode[0].getChildren(Messages.getString("basicQuery")); //$NON-NLS-1$
+ List<IConfigurationElement> basicQueryCollection = Arrays.asList(itemQueries);
+ List<IConfigurationElement> navigationQueryCollection =
+ Arrays.asList(itemQueriesNode[0].getChildren(Messages.getString("CategoryRegistry.NavigationQuery"))); //$NON-NLS-1$
+ basicQueryCollection.addAll(navigationQueryCollection);
+ itemQueries = (IConfigurationElement[]) basicQueryCollection.toArray();
+ for (IConfigurationElement itemQueryConfigurationElement : itemQueries) {
+ Object queryInstance = createInstance(itemQueryConfigurationElement, DEFAULT_CLASS_ATTRIBUTE);
+ category.addItemQuery(queryInstance);
+ }
+ }
+
+ // Retrieve category queries
+ IConfigurationElement[] queryConfigurationElements = categoryConfigurationElement.getChildren(Messages.getString("CategoryRegistry.CategoryQuery")); //$NON-NLS-1$
+ if (queryConfigurationElements.length > 0) {
+ Object query = null;
+ IConfigurationElement queryConfigurationElement = queryConfigurationElements[0];
+ IConfigurationElement[] categoryQueries = queryConfigurationElement.getChildren(Messages.getString("basicQuery")); //$NON-NLS-1$
+ if (categoryQueries.length == 0) {
+ categoryQueries = queryConfigurationElement.getChildren(Messages.getString("CategoryRegistry.NavigationQuery")); //$NON-NLS-1$
+ }
+
+ if (categoryQueries.length > 0) {
+ query = createInstance(categoryQueries[0], DEFAULT_CLASS_ATTRIBUTE);
+ }
+ category.setQuery(query);
+ }
+
+ // Retrieve type.
+ IConfigurationElement[] typeConfigurationElement = categoryConfigurationElement.getChildren(Messages.getString("CategoryRegistry.AvailableForType")); //$NON-NLS-1$
+ if (typeConfigurationElement.length > 0) {
+ String qualifiedClassName = typeConfigurationElement[0].getAttribute(DEFAULT_CLASS_ATTRIBUTE);
+ category.setTypeFullyQualifiedName(qualifiedClassName);
+ }
+
+ // Retrieve target explorer id : a category is specific to an explorer.
+ IConfigurationElement[] targetExplorerIdNode = categoryConfigurationElement.getChildren(Messages.getString("CategoryRegistry.TargetExplorerId")); //$NON-NLS-1$
+ if (targetExplorerIdNode.length > 0) {
+ IConfigurationElement explorerIdConfigurationElement = targetExplorerIdNode[0];
+ // Register the category in the proper cache.
+ String id = explorerIdConfigurationElement.getAttribute(DEFAULT_ID_ATTRIBUTE);
+ if (id.equalsIgnoreCase(IExplorerContentProvider.ID_CURRENT_CP)) {
+ // index categories by ids.
+ currentElementRegistry.put(categoryId, category);
+ } else if (id.equalsIgnoreCase(IExplorerContentProvider.ID_REFERENCING_CP)) {
+ referencingElementRegistry.put(categoryId, category);
+ } else if (id.equalsIgnoreCase(IExplorerContentProvider.ID_REFERENCED_CP)) {
+ referencedElementRegistry.put(categoryId, category);
+ } else {
+ // ID_DIAGRAM_CP Statement.
+ diagramElementRegistry.put(categoryId, category);
+ }
+ }
+ }
+ }
+
+ /**
+ * Singleton accessor.
+ * @return
+ */
+ public static CategoryRegistry getInstance() {
+ if (_categoryRegistry == null) {
+ _categoryRegistry = new CategoryRegistry();
+ }
+ return _categoryRegistry;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/ICategory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/ICategory.java
new file mode 100644
index 0000000..3164893
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/ICategory.java
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.category;
+
+import java.util.List;
+
+
+/**
+ * Represents a category of elements in the tree viewer dedicated to semantic browsing.
+ */
+public interface ICategory {
+ /**
+ * Return a set of elements resulting from a query.
+ * @param currentElement_p
+ * @return
+ */
+ public List<Object> compute(Object currentElement_p);
+
+ /**
+ * Id setter.
+ * @param id_p
+ */
+ public void setId(String id_p);
+
+ /**
+ * Add Sub category id.
+ * @param id_p
+ */
+ public void addSubCategoryId(String id_p);
+
+ /**
+ * Set Query object. Could be a basic query or a navigation query.
+ * @param query_p
+ */
+ public void setQuery(Object query_p);
+
+ /**
+ *
+ * @param element_p
+ */
+ public void setTypeFullyQualifiedName(String element_p);
+
+ /**
+ * @param currentElement_p
+ * @return true if
+ */
+ public boolean isAvailableForType(Object currentElement_p);
+
+ /**
+ * SubCategory Ids getter.
+ * @return
+ */
+ public List<String> getSubCategoryIds();
+
+ /**
+ * Name setter.
+ * @param categoryName_p
+ */
+ public void setName(String categoryName_p);
+
+ /**
+ * Name getter.
+ * @return
+ */
+ public String getName();
+
+ /**
+ * IsTopLevel setter.
+ * @param isTopLevel_p
+ */
+ public void setIsTopLevel(boolean isTopLevel_p);
+
+ /**
+ * Return true if Category is top level category.
+ * Means the category is a direct child of an element (which is not a category).
+ * @return
+ */
+ public boolean isTopLevel();
+
+ /**
+ * Get item queries.
+ * @return
+ */
+ public List<Object> getItemQueries();
+
+ /**
+ * Set item queries.
+ * @param queries_p set of queries.
+ */
+ public void addItemQuery(Object queries_p);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/Messages.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/Messages.java
new file mode 100644
index 0000000..e8ab728
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/Messages.java
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.category;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ *
+ */
+public class Messages {
+ private static final String BUNDLE_NAME = "org.eclipse.amalgam.explorer.contextual.core.category.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ //nothing to do.
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/messages.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/messages.properties
new file mode 100644
index 0000000..8191c01
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/category/messages.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+#-------------------------------------------------------------------------------
+
+CategoryRegistry.ContentProvider=contentProviderCategory
+CategoryRegistry.SubCategory=subCategories
+ItemQueries=itemQueries
+CategoryRegistry.Category=category
+CategoryRegistry.CategoryQueries=categoryQueries
+CategoryRegistry.CategoryQuery=categoryQuery
+CategoryRegistry.AvailableForType=availableForType
+CategoryRegistry.TargetExplorerId=targetExplorerId
+CategoryRegistry.NavigationQuery=navigationQuery
+CategoryRegistry.TopLevel=isTopLevel
+basicQuery=basicQuery
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ext/AbstractExtensionPointManager.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ext/AbstractExtensionPointManager.java
new file mode 100644
index 0000000..84f606a
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/ext/AbstractExtensionPointManager.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.ext;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+/**
+ *
+ */
+public abstract class AbstractExtensionPointManager {
+
+ public static final String DEFAULT_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ public static final String DEFAULT_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+
+ public static final String DEFAULT_ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+
+ public static IConfigurationElement[] getConfigurationElementsFor(String pluginId_p, String extensionPointId_p) {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IConfigurationElement[] configElements = extensionRegistry.getConfigurationElementsFor(pluginId_p, extensionPointId_p);
+ return configElements;
+ }
+
+ public static <T extends Object> T createTypedInstance(IConfigurationElement configurationElement_p,
+ String attributeName_p,
+ Class<T> type_p) {
+ T typedInstance = null;
+ Object instance = null;
+ // create an executable extension.
+ try {
+ instance = configurationElement_p.createExecutableExtension(attributeName_p);
+ } catch (CoreException e) {
+ String message = "Unable to create instance of class :"; //$NON-NLS-1$
+ message.concat(configurationElement_p.getAttribute(attributeName_p));
+ IStatus status = new Status(IStatus.ERROR, ExplorerActivator.PLUGIN_ID, message, e);
+ ExplorerActivator.getDefault().getLog().log(status);
+ }
+
+ // Cast it to the passed generic type.
+ try {
+ typedInstance = type_p.cast(instance);
+ } catch (ClassCastException e) {
+ String message = "Unable to cast class "; //$NON-NLS-1$
+ message.concat(configurationElement_p.getAttribute(attributeName_p));
+ IStatus status = new Status(IStatus.ERROR, ExplorerActivator.PLUGIN_ID, message, e);
+ message.concat(" To ");
+ message.concat(type_p.getName());
+ ExplorerActivator.getDefault().getLog().log(status);
+ }
+
+ return typedInstance;
+ }
+
+ public static Object createInstance(IConfigurationElement configurationElement_p, String attributeName_p) {
+ return createTypedInstance(configurationElement_p, attributeName_p, Object.class);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/CandidateElementFilterManager.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/CandidateElementFilterManager.java
new file mode 100644
index 0000000..0289b46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/CandidateElementFilterManager.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.filter;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ *
+ */
+public final class CandidateElementFilterManager extends AbstractExtensionPointManager{
+
+ private static final String FILTER_CONF_ELEMENT_NAME = "candidateElementFilter";
+
+ private static final Logger _logger = Logger.getLogger(ExplorerActivator.PLUGIN_ID);
+
+ /** Filters Map. This map structured as following <Filter ID, Filter Instance> **/
+ private static Map<String, ICandidateElementFilter> _filterRegistry;
+
+ /**
+ * Check if a given element has to be displayed in the Contextual Explorer view or not.
+ * @param object the candidate element to evaluation acceptance.
+ * @return True if the element is to accept, false otherwise.
+ */
+ public static boolean accept(Object object){
+ Map<String, ICandidateElementFilter> filters = getFilters();
+ // There no filter in the platform. So accept all elements.
+ if (filters.isEmpty())
+ return true;
+
+ Set<String> filters_ids = filters.keySet();
+ for (String filters_id : filters_ids)
+ {
+ ICandidateElementFilter iFilter = filters.get(filters_id);
+ if (false == iFilter.accept(object))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get available filters.
+ * @return a {@link Map} of available filters containing data organized as <code> <Filter ID, {@link ICandidateElementFilter}> <code/>
+ */
+ public static Map<String, ICandidateElementFilter> getFilters(){
+ if (_filterRegistry == null)
+ {
+ _filterRegistry = new HashMap<String, ICandidateElementFilter>();
+ IConfigurationElement[] configurationElements = getConfigurationElementsFor(ExplorerActivator.PLUGIN_ID, FILTER_CONF_ELEMENT_NAME);
+ for (IConfigurationElement iConfigurationElement : configurationElements)
+ {
+ String filter_id = iConfigurationElement.getAttribute(DEFAULT_ID_ATTRIBUTE);
+ ICandidateElementFilter filter = createTypedInstance(iConfigurationElement, DEFAULT_CLASS_ATTRIBUTE, ICandidateElementFilter.class);
+ if (_filterRegistry.get(filter_id) == null)
+ {
+ _filterRegistry.put(filter_id, filter);
+ }
+ else
+ {
+ String filter_class = iConfigurationElement.getAttribute(DEFAULT_CLASS_ATTRIBUTE);
+ _logger.error("Filter ID : " + filter_id +" is shared by many filters. Only the folowing filter will be retained : " + filter_class);
+ }
+ }
+ }
+ return _filterRegistry;
+ }
+
+ /**
+ * Return a filter corresponding to the id provided in parameter <code>filterID<code/>
+ * @param filterID the id of the filter
+ * @return Filter
+ */
+ public static ICandidateElementFilter getFilter(String filterID){
+ ICandidateElementFilter result = getFilters().get(filterID);
+ if (result != null) {
+ return result;
+ }
+ throw new RuntimeException("There is no filter with id = " + filterID);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/ICandidateElementFilter.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/ICandidateElementFilter.java
new file mode 100644
index 0000000..eaf3594
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/filter/ICandidateElementFilter.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.filter;
+
+/**
+ * This interface allows contributor to add filter on element returned by an IQuery.
+ */
+public interface ICandidateElementFilter {
+
+ /**
+ * Check if the filter must be active on a given Candidate Element.
+ * @param object the candidate element
+ * @return True if the filter must be active on the candidate element<code>object<code/>, False otherwise.
+ */
+ public boolean select(Object object);
+
+ /**
+ * Accept or not the Candidate Element
+ * @param object the candidate element
+ * @return True if the candidate element is to display in Contextual Explorer View, False otherwise.
+ */
+ public boolean accept(Object object);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/internal/TypeHelper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/internal/TypeHelper.java
new file mode 100644
index 0000000..37ecb52
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/internal/TypeHelper.java
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.internal;
+
+/**
+ *
+ */
+public class TypeHelper {
+ /**
+ * Singleton.
+ */
+ protected static TypeHelper typeHelper = null;
+
+ /**
+ * Constructor.
+ */
+ private TypeHelper() {
+ }
+
+ public static TypeHelper getInstance() {
+ if (typeHelper == null) {
+ typeHelper = new TypeHelper();
+ }
+ return typeHelper;
+ }
+
+ /**
+ *
+ * @param element
+ * @param type
+ * @return
+ */
+ public boolean isInstanceOf(Object element, String type) {
+ // null isn't an instance of of anything.
+ if (element == null)
+ return false;
+ return isSubtype(element.getClass(), type);
+ }
+
+ /**
+ *
+ * @param clazz
+ * @param type
+ * @return
+ */
+ @SuppressWarnings("rawtypes")
+ private boolean isSubtype(Class clazz, String type) {
+ if (clazz.getName().equals(type))
+ return true;
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null && isSubtype(superClass, type))
+ return true;
+ Class[] interfaces = clazz.getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ if (isSubtype(interfaces[i], type))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/model/IExplorerContextualModel.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/model/IExplorerContextualModel.java
new file mode 100644
index 0000000..29204f0
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/model/IExplorerContextualModel.java
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.model;
+
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryImpl;
+import org.eclipse.amalgam.explorer.contextual.core.category.ICategory;
+
+public interface IExplorerContextualModel {
+
+ /**
+ * This allows to initialize a category show state.
+ * @param categoryName_p the name of the category
+ * @param showState_p the new state of the category Show/Hide.
+ */
+ public void setCategoryShowState(String categoryName_p, boolean showState_p);
+
+ /**
+ * Return the show state of a category
+ * @param categoryName_p the name of the category to return it's show state
+ * @return True means that the category will be displayed, False otherwise.
+ */
+ public boolean getCategoryShowState(String categoryName_p);
+
+ public boolean doesLimitateTreeExpansion();
+
+ public void setLimitateTreeExpansion(boolean limitateTreeExpansion_p);
+
+ public boolean doesShowCategory(ICategory category_p);
+
+ public void saveExpandedState(CategoryImpl category, String explorerID, boolean expanded);
+
+ public boolean getExpandedState(ICategory category, String explorerID);
+
+ public boolean containsExpandedHistory(String explorerID);
+
+ public List<String> getOrCreateHistory(String explorerID);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProvider.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProvider.java
new file mode 100644
index 0000000..0b9c0ee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProvider.java
@@ -0,0 +1,360 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryRegistry;
+import org.eclipse.amalgam.explorer.contextual.core.category.ICategory;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.ExplorerElementWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.EObjectWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.query.impl.QueryAdapter;
+import org.eclipse.amalgam.explorer.contextual.core.util.ViewerHelper;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IViewerNotification;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.emf.transaction.ResourceSetChangeEvent;
+
+/**
+ * Controller.
+ */
+public abstract class AbstractContentProvider extends AbstractGroupedAdapterFactoryContentProvider implements IExplorerContentProvider {
+ /**
+ * Root element i.e the element given as initial input.
+ */
+ protected EObject _rootElement;
+
+ /**
+ * Flag that indicates input has changed.
+ */
+ protected boolean _inputHasChanged;
+
+ /**
+ * Weak hash map for seeking semantic container of an element (category or object)
+ */
+ protected HashMap<ExplorerElementWrapper, ExplorerElementWrapper> _semanticParentHashMap;
+
+ protected boolean refreshRequired = false;
+
+ protected IExplorerContextualModel model;
+
+ /**
+ * Constructor.
+ */
+ public AbstractContentProvider(AdapterFactory adapterFactory_p, IExplorerContextualModel model_p) {
+ super(adapterFactory_p);
+ model = model_p;
+ _semanticParentHashMap = new HashMap<ExplorerElementWrapper, ExplorerElementWrapper>(0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ _semanticParentHashMap.clear();
+ super.dispose();
+ }
+
+ /**
+ * Get category children.
+ * @param wrapper
+ * @param element
+ * @param gatheredElements
+ * @param gatheredCategories
+ */
+ protected void getCategoryChildren(ICategory category_p, ExplorerElementWrapper wrapper, Set<Object> gatheredElements) {
+ // lookup for the element that we need to query on.
+ EObject elementToQuery = lookUpEObject(wrapper);
+
+ // Gather subCategories & compute queries attached to the category.
+ gatheredElements.addAll(category_p.compute(elementToQuery));
+ gatheredElements.addAll(CategoryRegistry.getInstance().gatherSubCategories(getExplorerId(), elementToQuery, category_p));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] result = new Object[0];
+ try {
+ if (parentElement instanceof ExplorerElementWrapper) {
+ ExplorerElementWrapper wrapper = (ExplorerElementWrapper) parentElement;
+ // retrieve referenced element by the wrapper.
+ Object element = ((ExplorerElementWrapper) parentElement).getElement();
+ Set<Object> gatheredElements = new HashSet<Object>(0);
+ if (wrapper instanceof EObjectWrapper) {
+ // Provide the root element to the CurrentElement Explorer in purpose to display it.
+ if ((element == _rootElement) && _inputHasChanged) {
+ // Root element has no parent : store null value.
+ _semanticParentHashMap.put(wrapper, null);
+ _inputHasChanged = false;
+ if (getExplorerId().equalsIgnoreCase(IExplorerContentProvider.ID_CURRENT_CP)) {
+ return new Object[] { wrapper };
+ }
+ }
+ getElementChildren((EObject) element, wrapper, gatheredElements);
+ } else if (wrapper instanceof CategoryWrapper) {
+ getCategoryChildren((ICategory) element, wrapper, gatheredElements);
+ }
+
+ /**
+ * Wrap gathered elements & register each wrapper in cache.
+ */
+ Set<Object> wrappers = new HashSet<Object>(0);
+ for (Object gatherElement : gatheredElements) {
+ // ignore queries result that returns a null object (reference with cardinality max 1)
+ if (gatherElement != null) {
+ ExplorerElementWrapper elementWrapper = wrapElement(gatherElement);
+ // Add wrapper and element wrapper in internal data and returned collection.
+ wrappers.add(elementWrapper);
+ _semanticParentHashMap.put(elementWrapper, wrapper);
+ // Flag to filter out empty category.
+ boolean shouldRemovedEmptyCategoryWrapper = false;
+ if (gatherElement instanceof ICategory) {
+ if (!model.doesShowCategory((ICategory) gatherElement)) {
+ shouldRemovedEmptyCategoryWrapper = true;
+ } else {
+ Set<Object> categoryChildren = new HashSet<Object>(0);
+ // Compute category children, if no child, remove this category from displayed elements.
+ getCategoryChildren((ICategory) gatherElement, elementWrapper, categoryChildren);
+ if (categoryChildren.isEmpty()) {
+ shouldRemovedEmptyCategoryWrapper = true;
+ }
+ }
+ }
+ if (shouldRemovedEmptyCategoryWrapper) {
+ wrappers.remove(elementWrapper);
+ _semanticParentHashMap.remove(elementWrapper);
+ }
+ }
+ }
+
+ result = wrappers.toArray();
+ } else {
+ // Wrap given element. This input element can't be a Category because a category element is computed.
+ result = getChildren(new EObjectWrapper(parentElement));
+ }
+ } catch (Exception exception_p) {
+ ExplorerActivator.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, ExplorerActivator.PLUGIN_ID, "Error while getting children for " + parentElement, exception_p)); //$NON-NLS-1$
+ result = new Object[0];
+ }
+ return result;
+ }
+
+ /**
+ * Ge element children.
+ * @param wrapper
+ * @param gatheredElements
+ * @param gatheredCategories
+ * @param eObject
+ */
+ protected void getElementChildren(EObject eObject, ExplorerElementWrapper wrapper, Set<Object> gatheredElements) {
+ if (eObject != _rootElement) {
+ // If it's an item gather sub-queries from parent category.
+ ExplorerElementWrapper semanticParentWrapper = _semanticParentHashMap.get(wrapper);
+ if (null != semanticParentWrapper) {
+ Object semanticParent = semanticParentWrapper.getElement();
+ if (semanticParent instanceof ICategory) {
+ // temporary result (list typed)
+ for (Object query : ((ICategory) semanticParent).getItemQueries()) {
+ // compute item queries with eobject as context.
+ gatheredElements.addAll(QueryAdapter.getInstance().compute(eObject, query));
+ }
+ }
+ }
+ }
+
+ // Gather direct categories for any eobject.
+ ExplorerElementWrapper parentWrapper = _semanticParentHashMap.get(wrapper);
+ if (null == _semanticParentHashMap.get(parentWrapper)) // for blocking recursion
+ {
+ gatheredElements.addAll(CategoryRegistry.getInstance().gatherCategories(getExplorerId(), eObject));
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getElements(Object rootElement_p) {
+ return getChildren(rootElement_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getParent(Object element_p) {
+ return _semanticParentHashMap.get(element_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasChildren(Object element_p) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void inputChanged(Viewer viewer_p, Object oldInput, Object newInput) {
+ if (null == viewer) {
+ viewer = viewer_p;
+ }
+ if (newInput instanceof ExplorerElementWrapper) {
+ if (oldInput == null) {
+ inputChanged(viewer_p, new EObjectWrapper(null), ((ExplorerElementWrapper) newInput).getElement());
+ } else if (oldInput instanceof ExplorerElementWrapper) {
+ inputChanged(viewer_p, ((ExplorerElementWrapper) oldInput).getElement(), ((ExplorerElementWrapper) newInput).getElement());
+ } else if (oldInput instanceof EObject) {
+ inputChanged(viewer_p, oldInput, ((ExplorerElementWrapper) newInput).getElement());
+ }
+ } else if (newInput instanceof EObject) {
+ // clear cache.
+ _semanticParentHashMap.clear();
+ _inputHasChanged = true;
+ _rootElement = (EObject) newInput;
+ } else if (null == newInput) {
+ // View is closing or no input selection.
+ _inputHasChanged = false;
+ _rootElement = null;
+ _semanticParentHashMap.clear();
+ }
+ }
+
+ /**
+ * Look up an eobject for specified wrapper.
+ * @param wrapper_p
+ * @return
+ */
+ private EObject lookUpEObject(ExplorerElementWrapper wrapper_p) {
+ ExplorerElementWrapper parentWrapper = _semanticParentHashMap.get(wrapper_p);
+ if (parentWrapper instanceof CategoryWrapper) {
+ return lookUpEObject(parentWrapper);
+ }
+ return (EObject) parentWrapper.getElement();
+ }
+
+ @Override
+ protected boolean refreshRequired(ResourceSetChangeEvent event_p) {
+ boolean result = false;
+ synchronized (this) {
+ if (refreshRequired) {
+ result = true;
+ }
+ }
+ // TODO bring back the code of the method initially available in GroupedAdapterFactoryContentProvider.
+ // This code has dependencies to Sirius, So find a way to break this link or move this class to UI plugins.
+ return result /*|| super.refreshRequired(event_p)*/;
+ }
+
+ /**
+ * Overridden to forward EObject notifications to wrapped equivalent objects.<br>
+ * {@inheritDoc}
+ */
+ @Override
+ public void notifyChanged(Notification notification_p) {
+
+ if (notification_p instanceof IViewerNotification) {
+ final IViewerNotification viewerNotification = (IViewerNotification) notification_p;
+ if (!viewerNotification.isContentRefresh()) {
+ Object element = viewerNotification.getElement();
+ Object wrappedElement = wrapElement(element);
+ if (null != wrappedElement) {
+ super.notifyChanged(ViewerNotification.wrapNotification(viewerNotification, wrappedElement));
+ }
+ } else {
+ // Impossible to know if modifications from other AbstractContentProvider instances in the Contextual Explorer have impacts on current one.
+ // Let's refresh completely the viewer.
+ // refresh fails here due to the poor content provider implementation based on EObjectWrapper & co.
+ synchronized (this) {
+ if (!refreshRequired) {
+ refreshRequired = true;
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void processRefresh() {
+ boolean refresh = false;
+
+ // If we need to refresh complete view, we refresh it and don't perform any refresh for all others notifications
+ synchronized (this) {
+ refresh = refreshRequired;
+ refreshRequired = false;
+
+ if (refreshRequired) {
+ notifications = null;
+ toRefresh = null;
+ }
+ }
+
+ if (!refresh) {
+ super.processRefresh();
+
+ } else {
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+ ViewerHelper.run((StructuredViewer) viewer, new Runnable() {
+ @SuppressWarnings("synthetic-access")
+ public void run() {
+ Object input = viewer.getInput();
+ viewer.setInput(input);
+ }
+ });
+ }
+ }
+
+ }
+
+ /**
+ * Wrap element in the proper wrapper.
+ * @param gatherElement_p
+ * @return
+ */
+ private ExplorerElementWrapper wrapElement(Object gatherElement_p) {
+ ExplorerElementWrapper wrapper = null;
+ if ((gatherElement_p != null) && (gatherElement_p instanceof EObject)) {
+ wrapper = new EObjectWrapper(gatherElement_p);
+ } else if (gatherElement_p instanceof ICategory) {
+ wrapper = new CategoryWrapper(gatherElement_p);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Get root element.
+ * @return
+ */
+ public EObject getRootElement() {
+ return _rootElement;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProviderFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProviderFactory.java
new file mode 100644
index 0000000..a3e5807
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractContentProviderFactory.java
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * Provide an interface for a content provider factory.
+ */
+public abstract class AbstractContentProviderFactory extends AbstractExtensionPointManager{
+ /**
+ * Singleton.
+ */
+ protected static AbstractContentProviderFactory _instance = null;
+ protected IExplorerContextualModel model;
+ private static final String CONTENT_PROVIDER_FACTORY = "contentProviderFactory"; //$NON-NLS-1$
+
+ public abstract ITreeContentProvider getCurrentContentProvider();
+
+ public abstract ITreeContentProvider getReferencedContentProvider();
+
+ public abstract ITreeContentProvider getReferencingContentProvider();
+
+ /**
+ * Singleton accessor.
+ * @return
+ */
+ public static AbstractContentProviderFactory getInstance() {
+ if (null == _instance)
+ {
+ IConfigurationElement[] configurationElements =
+ getConfigurationElementsFor(ExplorerActivator.PLUGIN_ID, CONTENT_PROVIDER_FACTORY);
+
+ for (IConfigurationElement configurationElement : configurationElements)
+ {
+ AbstractContentProviderFactory contentProvider =
+ createTypedInstance(configurationElement, DEFAULT_CLASS_ATTRIBUTE, AbstractContentProviderFactory.class);
+ if (null != contentProvider)
+ {
+ _instance = contentProvider;
+ break;
+ }
+ }
+
+ if (null == _instance)
+ {
+ _instance = new DefaultContentProviderFactory(new ComposedAdapterFactory());
+ }
+ }
+ return _instance;
+ }
+
+ public void setModel(IExplorerContextualModel model_p) {
+ model = model_p;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractGroupedAdapterFactoryContentProvider.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractGroupedAdapterFactoryContentProvider.java
new file mode 100644
index 0000000..fda9b44
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractGroupedAdapterFactoryContentProvider.java
@@ -0,0 +1,255 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IViewerNotification;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.NotifyChangedToViewerRefresh;
+import org.eclipse.emf.transaction.ResourceSetChangeEvent;
+import org.eclipse.emf.transaction.ResourceSetListener;
+import org.eclipse.emf.transaction.ResourceSetListenerImpl;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * A content provider which doens't sent async refresh of ui for each notification.
+ * At end of transaction, for all notification received, we trigger only one refresh performing refreshes of all notified objects.
+ */
+public abstract class AbstractGroupedAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+
+ protected ResourceSetListener listener = null;
+
+ protected Collection<Notification> notifications = null;
+
+ protected Collection<EObject> toRefresh = new HashSet<EObject>();
+
+
+ /**
+ * @param event_p
+ * @return
+ */
+ protected abstract boolean refreshRequired(ResourceSetChangeEvent event_p) ;
+ /**
+ * @param adapterFactory_p
+ */
+ public AbstractGroupedAdapterFactoryContentProvider(AdapterFactory adapterFactory_p) {
+ super(adapterFactory_p);
+ }
+
+ protected ResourceSetListener getListener() {
+ if (listener == null) {
+ listener = new ResourceSetListenerImpl() {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isPostcommitOnly() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void resourceSetChanged(ResourceSetChangeEvent event_p) {
+ super.resourceSetChanged(event_p);
+ if (refreshRequired(event_p)) {
+ runRefresh();
+ }
+ }
+ };
+ }
+ return listener;
+ }
+
+ public void notifyChanged2(Notification notification) {
+ // If the notification is an IViewerNotification, it specifies how ViewerRefresh should behave. Otherwise fall
+ // back to NotifyChangedToViewerRefresh, which determines how to refresh the viewer directly from the model
+ // notification.
+ if (notification instanceof IViewerNotification) {
+ viewerRefresh.addNotification((IViewerNotification) notification);
+
+ } else {
+ new NotifyChangedToViewerRefresh().refresh(viewer, notification.getNotifier(), notification.getEventType(), notification.getFeature(),
+ notification.getOldValue(), notification.getNewValue(), notification.getPosition());
+ }
+ }
+
+ public void runRefresh() {
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+
+ UIJob job = new UIJob(viewer.getControl().getDisplay(), Messages.GroupedAdapterFactoryContentProvider_RefreshViewer) {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor_p) {
+ processRefresh();
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ }
+
+ protected void processRefresh() {
+ Collection<Notification> currentNotifications = null;
+ Collection<EObject> currentRefresh = null;
+
+ synchronized (this) {
+ currentNotifications = notifications;
+ notifications = null;
+ currentRefresh = toRefresh;
+ toRefresh = null;
+ }
+
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+ HashSet<ChangeNotification> duplicateNotifications = new HashSet<ChangeNotification>();
+
+ if ((currentNotifications != null) && (currentNotifications.size() > 0)) {
+ viewerRefresh = new ViewerRefresh(viewer);
+ for (Notification notification : currentNotifications) {
+ ChangeNotification changeNotification =
+ new ChangeNotification(notification.getNotifier(), notification.getFeature(), notification.getNewValue(), notification.getEventType());
+ if (!duplicateNotifications.contains(changeNotification)) {
+ duplicateNotifications.add(changeNotification);
+ notifyChanged2(notification);
+ }
+ }
+
+ duplicateNotifications.clear();
+
+ if (viewerRefresh != null) {
+ viewerRefresh.run();
+ viewerRefresh = null;
+ }
+ currentNotifications.clear();
+ }
+
+ if ((currentRefresh != null) && (currentRefresh.size() > 0)) {
+ ((StructuredViewer) viewer).update(currentRefresh.toArray(), null);
+ currentRefresh.clear();
+ }
+ }
+ }
+
+ public synchronized void addNotification(Notification notification_p) {
+ if (notifications == null) {
+ notifications = new ArrayList<Notification>();
+ }
+ notifications.add(notification_p);
+ }
+
+ /**
+ * @param notifications_p
+ */
+ protected synchronized void addNotifications(List<Notification> notifications_p) {
+ if (notifications == null) {
+ notifications = new ArrayList<Notification>();
+ }
+ notifications.addAll(notifications_p);
+ }
+
+ public synchronized void addObject(EObject eObject_p) {
+ if (toRefresh == null) {
+ toRefresh = new HashSet<EObject>();
+ }
+ toRefresh.add(eObject_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void notifyChanged(Notification notification_p) {
+ addNotification(notification_p);
+ }
+
+ /**
+ * Name change notification
+ */
+ protected class ChangeNotification {
+ private WeakReference<Object> _notifierReference;
+ private WeakReference<Object> _featureReference;
+ private WeakReference<Object> _newValueReference;
+ private int _eventType;
+
+ /**
+ * Constructor.
+ * @param eventType_p
+ * @param newValue_p
+ * @param notifier_p
+ */
+ public ChangeNotification(Object notifier_p, Object feature_p, Object newValue_p, int eventType_p) {
+ _notifierReference = new WeakReference<Object>(notifier_p);
+ _featureReference = new WeakReference<Object>(feature_p);
+ _newValueReference = new WeakReference<Object>(newValue_p);
+ _eventType = eventType_p;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object object_p) {
+ boolean cr = super.equals(object_p);
+
+ if (!cr && (object_p instanceof ChangeNotification)) {
+ ChangeNotification notification = (ChangeNotification) object_p;
+ cr = true;
+
+ if (!(((_notifierReference.get() == null) && (notification._notifierReference.get() == null)) || ((_notifierReference.get() != null) && _notifierReference
+ .get().equals(notification._notifierReference.get())))) {
+ cr = false;
+
+ } else if (!(((_featureReference.get() == null) && (notification._featureReference.get() == null)) || ((_featureReference.get() != null) && _featureReference
+ .get().equals(notification._featureReference.get())))) {
+ cr = false;
+
+ } else if (!(((_newValueReference.get() == null) && (notification._newValueReference.get() == null)) || ((_newValueReference.get() != null) && _newValueReference
+ .get().equals(notification._newValueReference.get())))) {
+ cr = false;
+ }
+
+ cr = (cr) ? _eventType == notification._eventType : false;
+ }
+ return cr;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ int result = 17;
+ if (_notifierReference.get() != null) {
+ result = (37 * result) + _notifierReference.get().hashCode();
+ }
+ if (_featureReference.get() != null) {
+ result = (37 * result) + _featureReference.get().hashCode();
+ }
+ if (_newValueReference.get() != null) {
+ result = (37 * result) + _newValueReference.get().hashCode();
+ }
+ result = (37 * result) + _eventType;
+ return result;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractLabelProviderFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractLabelProviderFactory.java
new file mode 100644
index 0000000..647405c
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/AbstractLabelProviderFactory.java
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ */
+public abstract class AbstractLabelProviderFactory extends AbstractExtensionPointManager{
+
+ /**
+ * Singleton.
+ */
+ protected static AbstractLabelProviderFactory _instance = null;
+
+ private static final String LABEL_PROVIDER_FACTORY = "labelProviderFactory"; //$NON-NLS-1$
+
+ protected abstract ILabelProvider getLabelProvider();
+
+ /**
+ * Singleton accessor.
+ * @return
+ */
+ public static AbstractLabelProviderFactory getInstance() {
+ if (null == _instance)
+ {
+ IConfigurationElement[] configurationElements = getConfigurationElementsFor(ExplorerActivator.PLUGIN_ID, LABEL_PROVIDER_FACTORY);
+ for (IConfigurationElement configurationElement : configurationElements)
+ {
+ AbstractLabelProviderFactory labelProvider = createTypedInstance(configurationElement, DEFAULT_CLASS_ATTRIBUTE, AbstractLabelProviderFactory.class);
+ if (null != labelProvider)
+ {
+ _instance = labelProvider;
+ }
+ }
+
+ if (null == _instance)
+ {
+ _instance = new DefaultLabelProviderFactory();
+ }
+ }
+ return _instance;
+ }
+
+ public ILabelProvider getCurrentLabelProvider() {
+ return getLabelProvider();
+ }
+
+ public ILabelProvider getReferencedLabelProvider() {
+ return getLabelProvider();
+ }
+
+ public ILabelProvider getReferencingLabelProvider() {
+ return getLabelProvider();
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultContentProviderFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultContentProviderFactory.java
new file mode 100644
index 0000000..e58579d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultContentProviderFactory.java
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.CurrentElementCP;
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.ReferencedElementCP;
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.ReferencingElementCP;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * Default implementation of a ContentProvideFactory for ExplorerContextual.
+ */
+public class DefaultContentProviderFactory extends AbstractContentProviderFactory {
+
+ private AdapterFactory _adapterFactory;
+
+ /**
+ * Constructor.
+ */
+ public DefaultContentProviderFactory(AdapterFactory adapterFactory_p) {
+ _adapterFactory = adapterFactory_p;
+ }
+
+ /**
+ * Get the adapter factory.
+ * @return the adapterFactory
+ */
+ protected AdapterFactory getAdapterFactory() {
+ return _adapterFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getCurrentContentProvider() {
+ return new CurrentElementCP(getAdapterFactory(), model);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getReferencedContentProvider() {
+ return new ReferencedElementCP(getAdapterFactory(), model);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getReferencingContentProvider() {
+ return new ReferencingElementCP(getAdapterFactory(), model);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultLabelProviderFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultLabelProviderFactory.java
new file mode 100644
index 0000000..b2c1043
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/DefaultLabelProviderFactory.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.amalgam.explorer.contextual.core.category.CategoryImpl;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.EObjectWrapper;
+import org.eclipse.amalgam.explorer.contextual.core.util.ImageUtils;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ */
+public class DefaultLabelProviderFactory extends AbstractLabelProviderFactory {
+
+ @Override
+ protected ILabelProvider getLabelProvider() {
+ return new ILabelProvider() {
+
+ private IItemLabelProvider getItemProvider(Object object_p){
+ if (null == object_p) {
+ return null;
+ }
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) AdapterFactoryEditingDomain.getEditingDomainFor(object_p);
+ // Precondition.
+ if (null == editingDomain) {
+ return null;
+ }
+ IItemLabelProvider provider = (IItemLabelProvider) editingDomain.getAdapterFactory().adapt(object_p, IItemLabelProvider.class);
+ return provider;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public String getText(Object element) {
+ String result = "<Unknown>";
+
+ if (element instanceof CategoryWrapper)
+ {
+ CategoryImpl category = (CategoryImpl)((CategoryWrapper) element).getElement();
+ return category.getName();
+ }
+
+ if (element instanceof EObjectWrapper)
+ {
+ element = ((EObjectWrapper) element).getElement();
+ }
+
+ if (null != element)
+ {
+ IItemLabelProvider itemProvider = getItemProvider(element);
+ if (null != itemProvider)
+ result = itemProvider.getText(element);
+ }
+
+ return result;
+ }
+
+ @Override
+ public Image getImage(Object element_p) {
+ // Precondition.
+ if (null == element_p) {
+ return null;
+ }
+ // Initialize with the category image.
+ Image result = ImageUtils.getImage(ImageUtils.IMG_CATEGORY);
+ EObject eObject = null;
+ // Find out a model element from given element.
+ if (element_p instanceof EObjectWrapper)
+ {
+ eObject = (EObject) ((EObjectWrapper) element_p).getElement();
+ }
+ else
+ {
+ if (element_p instanceof EObject)
+ {
+ eObject = (EObject) element_p;
+ }
+ }
+
+ // If an eobject was found, get its image.
+ if (null != eObject)
+ {
+ IItemLabelProvider itemProvider = getItemProvider(eObject);
+ if (null != itemProvider)
+ {
+ Object image = itemProvider.getImage(eObject);
+ result = ExtendedImageRegistry.getInstance().getImage(image);
+ }
+
+ }
+
+ return result;
+ }
+ };
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/IExplorerContentProvider.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/IExplorerContentProvider.java
new file mode 100644
index 0000000..0e2334f
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/IExplorerContentProvider.java
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+/**
+ */
+public interface IExplorerContentProvider {
+ /**
+ * Explorer IDs.
+ */
+ static String ID_CURRENT_CP = "CurrentElementExplorer"; //$NON-NLS-1$
+ static String ID_REFERENCED_CP = "ReferencedElementExplorer"; //$NON-NLS-1$
+ static String ID_REFERENCING_CP = "ReferencingElementExplorer"; //$NON-NLS-1$
+
+ /**
+ * IdAccessor
+ * @return
+ */
+ String getExplorerId();
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/Messages.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/Messages.java
new file mode 100644
index 0000000..c76af9e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/Messages.java
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.amalgam.explorer.contextual.core.provider.messages"; //$NON-NLS-1$
+ public static String GroupedAdapterFactoryContentProvider_RefreshViewer;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/NotifiedContentProviderFactory.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/NotifiedContentProviderFactory.java
new file mode 100644
index 0000000..0fe0cb1
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/NotifiedContentProviderFactory.java
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider;
+
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.CurrentElementCP;
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.ReferencedElementCP;
+import org.eclipse.amalgam.explorer.contextual.core.provider.impl.ReferencingElementCP;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+public abstract class NotifiedContentProviderFactory extends DefaultContentProviderFactory {
+
+ public abstract boolean isListeningToPageSelectionEvents(Notification notification_p);
+
+ public NotifiedContentProviderFactory(AdapterFactory adapterFactory_p) {
+ super(adapterFactory_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getCurrentContentProvider() {
+
+ return new CurrentElementCP(getAdapterFactory(), model) {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void notifyChanged(Notification notification_p) {
+ if (isListeningToPageSelectionEvents(notification_p)) {
+ super.notifyChanged(notification_p);
+ }
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getReferencedContentProvider() {
+ return new ReferencedElementCP(getAdapterFactory(), model) {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void notifyChanged(Notification notification_p) {
+ if (isListeningToPageSelectionEvents(notification_p)) {
+ super.notifyChanged(notification_p);
+ }
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ITreeContentProvider getReferencingContentProvider() {
+ return new ReferencingElementCP(getAdapterFactory(), model) {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void notifyChanged(Notification notification_p) {
+ if (isListeningToPageSelectionEvents(notification_p)) {
+ super.notifyChanged(notification_p);
+ }
+ }
+ };
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/CurrentElementCP.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/CurrentElementCP.java
new file mode 100644
index 0000000..3e48bfe
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/CurrentElementCP.java
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.impl;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProvider;
+import org.eclipse.emf.common.notify.AdapterFactory;
+
+/**
+ */
+public class CurrentElementCP extends AbstractContentProvider {
+ /**
+ * Constructor.
+ * @param adapterFactory_p
+ */
+ public CurrentElementCP(AdapterFactory adapterFactory_p, IExplorerContextualModel model_p) {
+ super(adapterFactory_p, model_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getExplorerId() {
+ return ID_CURRENT_CP;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencedElementCP.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencedElementCP.java
new file mode 100644
index 0000000..8a5cf5e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencedElementCP.java
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.impl;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProvider;
+import org.eclipse.emf.common.notify.AdapterFactory;
+
+/**
+ */
+public class ReferencedElementCP extends AbstractContentProvider {
+ /**
+ * Constructor.
+ * @param adapterFactory_p
+ */
+ public ReferencedElementCP(AdapterFactory adapterFactory_p, IExplorerContextualModel model_p) {
+ super(adapterFactory_p, model_p);
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getExplorerId() {
+ return ID_REFERENCED_CP;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencingElementCP.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencingElementCP.java
new file mode 100644
index 0000000..23508e9
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/impl/ReferencingElementCP.java
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.impl;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.provider.AbstractContentProvider;
+import org.eclipse.emf.common.notify.AdapterFactory;
+
+/**
+ */
+public class ReferencingElementCP extends AbstractContentProvider {
+ /**
+ * Constructor.
+ * @param adapterFactory_p
+ */
+ public ReferencingElementCP(AdapterFactory adapterFactory_p, IExplorerContextualModel model_p) {
+ super(adapterFactory_p, model_p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getExplorerId() {
+ return ID_REFERENCING_CP;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/messages.properties b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/messages.properties
new file mode 100644
index 0000000..d63e73e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/messages.properties
@@ -0,0 +1,11 @@
+#===============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+#===============================================================================
+GroupedAdapterFactoryContentProvider_RefreshViewer=Refresh view
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/util/LabelProviderFontAndColor.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/util/LabelProviderFontAndColor.java
new file mode 100644
index 0000000..a0f5461
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/util/LabelProviderFontAndColor.java
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.util;
+
+import org.eclipse.amalgam.explorer.contextual.core.provider.wrapper.CategoryWrapper;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+public class LabelProviderFontAndColor implements IColorProvider, IFontProvider {
+ /**
+ * The font used for category, to not forget to dispose it
+ */
+ private Font _font;
+
+ /**
+ * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
+ */
+ @Override
+ public Color getBackground(Object element_p) {
+ // Do nothing.
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ */
+ @Override
+ public Color getForeground(Object element_p) {
+ if (element_p instanceof CategoryWrapper)
+ {
+ return PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ */
+ @Override
+ public Font getFont(Object element_p) {
+ if (element_p instanceof CategoryWrapper)
+ {
+ if (null == _font)
+ {
+ Display defaultDisplay = Display.getDefault();
+ Font result = defaultDisplay.getSystemFont();
+ FontData fontData = result.getFontData()[0];
+ fontData.setStyle(SWT.BOLD);
+ _font = new Font(defaultDisplay, fontData);
+ }
+ return _font;
+ }
+ return null;
+ }
+
+ /**
+ * Dispose Font object
+ */
+ public void dispose() {
+ if (null != _font)
+ {
+ _font.dispose();
+ _font = null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/CategoryWrapper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/CategoryWrapper.java
new file mode 100644
index 0000000..55ee10e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/CategoryWrapper.java
@@ -0,0 +1,24 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.wrapper;
+
+/**
+ * Wrapper for a ICategory element.
+ */
+public class CategoryWrapper extends ExplorerElementWrapper {
+ /**
+ * Constructor.
+ * @param element_p
+ */
+ public CategoryWrapper(Object element_p) {
+ super(element_p);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/EObjectWrapper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/EObjectWrapper.java
new file mode 100644
index 0000000..2aac0a7
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/EObjectWrapper.java
@@ -0,0 +1,24 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.wrapper;
+
+/**
+ * Wrapper for a EObject.
+ */
+public class EObjectWrapper extends ExplorerElementWrapper {
+ /**
+ * Constructor.
+ * @param element_p
+ */
+ public EObjectWrapper(Object element_p) {
+ super(element_p);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/ExplorerElementWrapper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/ExplorerElementWrapper.java
new file mode 100644
index 0000000..03be849
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/provider/wrapper/ExplorerElementWrapper.java
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.provider.wrapper;
+
+import org.eclipse.jface.util.Util;
+
+/**
+ * Each object of the treeview shall be unique. The wrapper will give an object a unique address. By this way, different categories could not own the same
+ * object : parent of a wrapper instance is unique & filters could be applied also.
+ */
+public abstract class ExplorerElementWrapper {
+ /**
+ * Element wrapped. Could be a ICategory or EObject.
+ */
+ private Object element;
+
+ /**
+ * Constructor.
+ */
+ public ExplorerElementWrapper(Object element_p) {
+ element = element_p;
+ }
+
+ /**
+ * Get underlying element.
+ * @return the element_p
+ */
+ public Object getElement() {
+ return element;
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (object instanceof ExplorerElementWrapper) {
+ return Util.equals(this.element, ((ExplorerElementWrapper) object).element);
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return Util.hashCode(element);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/ICustomQueryExecutionManager.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/ICustomQueryExecutionManager.java
new file mode 100644
index 0000000..fac5c27
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/ICustomQueryExecutionManager.java
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.query;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface ICustomQueryExecutionManager {
+
+ /**
+ *
+ * @param query_p
+ * @param modelElment
+ * @return
+ */
+ public List<Object> executeWithResult(Object query_p, Object modelElment);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/IQuery.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/IQuery.java
new file mode 100644
index 0000000..67390c1
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/IQuery.java
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.query;
+
+import java.util.List;
+
+/**
+ * Represents a Query.
+ *
+ */
+public interface IQuery {
+ public List<Object> compute(Object object_p);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryAdapter.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryAdapter.java
new file mode 100644
index 0000000..0c37bc6
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryAdapter.java
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.query.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ */
+public class QueryAdapter {
+ /**
+ * Singleton.
+ */
+ private static QueryAdapter _instance = null;
+
+ /**
+ * Singleton constructor.
+ */
+ private QueryAdapter() {
+ // nothing to do.
+ }
+
+ /**
+ * Singleton accessor.
+ * @return
+ */
+ public static QueryAdapter getInstance() {
+ if (_instance == null) {
+ _instance = new QueryAdapter();
+ }
+ return _instance;
+ }
+
+ /**
+ * Compute a query and return its result.
+ * @param currentElement_p context of the query.
+ */
+ public List<Object> compute(Object currentElement_p, Object query_p) {
+ if (currentElement_p instanceof EObject)
+ {
+ List<Object> executeQueryResult = QueryExecutionManager.getInstance().executeQueryWithResult(query_p, currentElement_p);
+ return executeQueryResult;
+ }
+ return Collections.emptyList();
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryComputeCommand.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryComputeCommand.java
new file mode 100644
index 0000000..5628ea1
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryComputeCommand.java
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.query.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.filter.CandidateElementFilterManager;
+import org.eclipse.amalgam.explorer.contextual.core.query.IQuery;
+import org.eclipse.emf.transaction.RunnableWithResult;
+
+/**
+ * Command for computing query.
+ */
+@SuppressWarnings("rawtypes")
+public class QueryComputeCommand extends RunnableWithResult.Impl {
+ protected List<Object> internalResult = null;
+ protected Object currentElement = null;
+ protected Object query = null;
+
+ /**
+ * Default Constructor
+ */
+ public QueryComputeCommand(Object currentElement_p, Object query_p) {
+ internalResult = new ArrayList<Object>(0);
+ currentElement = currentElement_p;
+ query = query_p;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ @SuppressWarnings("unchecked")
+ public void run() {
+ if (query instanceof IQuery)
+ {
+ for (Object o : ((IQuery) query).compute(currentElement))
+ {
+ if (CandidateElementFilterManager.accept(o))
+ internalResult.add(o);
+ }
+ setResult(internalResult);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryExecutionManager.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryExecutionManager.java
new file mode 100644
index 0000000..d74a335
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/query/impl/QueryExecutionManager.java
@@ -0,0 +1,225 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.query.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.amalgam.explorer.contextual.core.filter.CandidateElementFilterManager;
+import org.eclipse.amalgam.explorer.contextual.core.query.ICustomQueryExecutionManager;
+import org.eclipse.amalgam.explorer.contextual.core.query.IQuery;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+/**
+ *
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public final class QueryExecutionManager extends AbstractExtensionPointManager{
+
+ private static final String _CUSTOM_QUERY_EXEC_MANAGER__CONF_NAME = "customQueryExecutionManager";
+ private static final String _QUERY_CLASS__ATTR_NAME= "queryClass";
+ private static final String _QUERY_CUSTOM_EXECUTION_MANAGER_CLASS__ATTR_NAME= "customExecutionManager";
+
+ /** Singleton Variable **/
+ private static QueryExecutionManager _instance = null;
+
+ private Map<String, ICustomQueryExecutionManager> _availableCustomQueryExecutionManager ;
+
+ /** Singleton Variable initialization and getter **/
+ public static QueryExecutionManager getInstance(){
+ if (null == _instance)
+ _instance = new QueryExecutionManager();
+
+ return _instance;
+ }
+
+ /**
+ * Default Constructor
+ */
+ public QueryExecutionManager() {
+ _availableCustomQueryExecutionManager = new HashMap<String, ICustomQueryExecutionManager>();
+ initRegistry();
+ }
+
+ /**
+ * Execute a Query.
+ * @param query_p the query to execute
+ * @param currentElement_p the element the query is to execute for
+ * @return The query execution result
+ */
+ public List<Object> executeQueryWithResult(Object query_p, Object currentElement_p) {
+ List<Object> result = Collections.emptyList();
+ ICustomQueryExecutionManager customQueryExecution = getCustomQueryExecution(query_p);
+ if (null != customQueryExecution)
+ {
+ // TODO: Design extensions points and method
+ List<Object> executeWithResult = customQueryExecution.executeWithResult(query_p, currentElement_p);
+ result = new ArrayList<Object>(executeWithResult);
+ }
+ else
+ {
+ QueryComputeCommand queryComputeCommand = new QueryComputeCommand(currentElement_p, query_p);
+ try {
+ defaultQueryExecution(queryComputeCommand, currentElement_p);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ List<Object> queryResult = (List<Object>) queryComputeCommand.getResult();
+ if (null != queryResult)
+ result = new ArrayList<Object>(queryResult);
+ }
+
+ // Trim result from useless 'null' values.
+ for (Iterator<Object> iterator = result.iterator(); iterator.hasNext();)
+ {
+ Object next = iterator.next();
+ if (null == next)
+ {
+ iterator.remove();
+ }
+ else
+ {
+ // Apply all candidate elements filters acceptance condition
+ if (false == CandidateElementFilterManager.accept(next))
+ iterator.remove();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find a Custom Query Execution Manager
+ * @param query_p the query
+ * @return an {@link ICustomQueryExecutionManager} that will execute the query or
+ * <code>null</code> if no Custom Query Execution Manager is registered for that query.
+ */
+ private ICustomQueryExecutionManager getCustomQueryExecution(Object query_p) {
+ String queryClassName = query_p.getClass().getName();
+ ICustomQueryExecutionManager result = null;
+ // try to get Custom Execution Manager by the class name
+ result = _availableCustomQueryExecutionManager.get(queryClassName);
+
+ if (result == null)
+ {// This means that there is no Registered Execution Manager for the current query Class
+ // Check Supper Classes and Implemented Interfaces
+ result = checkClassIftypeOf(query_p.getClass());
+ }
+
+ return result;
+ }
+
+ /**
+ * Find a Custom Query Execution Manager registered from a super class or an implemented interface
+ * @param clazz the java {@link Class} of the current query
+ * @return an {@link ICustomQueryExecutionManager} that will execute the query or <code>null</code>
+ * if no Custom Query Execution Manager is registered for that query supper classes of implemented
+ * interfaces
+ */
+ private ICustomQueryExecutionManager checkClassIftypeOf(Class clazz){
+ ICustomQueryExecutionManager result = null;
+ Class superclass = clazz.getSuperclass();
+ // Check class super classes
+ if (superclass != null)
+ {
+ result = _availableCustomQueryExecutionManager.get(superclass.getName());
+ if (null == result)
+ result = checkClassIftypeOf(superclass);
+ }
+
+ // Check now implemented interfaces if result is still null
+ if (result == null)
+ {
+ Class[] interfaces = clazz.getInterfaces();
+ for (Class iInterface : interfaces)
+ {
+ result = _availableCustomQueryExecutionManager.get(iInterface.getName());
+ if (null == result)
+ result = checkClassIftypeOf(iInterface);
+ else
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Initialize the Registry of Custom execution managers
+ */
+ private void initRegistry() {
+ IConfigurationElement[] configurationElements =
+ getConfigurationElementsFor(ExplorerActivator.PLUGIN_ID, _CUSTOM_QUERY_EXEC_MANAGER__CONF_NAME);
+
+ for (IConfigurationElement iConfigurationElement : configurationElements)
+ {
+ String queryClassFQN = "";
+ ICustomQueryExecutionManager execManager = null;
+ queryClassFQN = iConfigurationElement.getAttribute(_QUERY_CLASS__ATTR_NAME);
+// execManager = (ICustomQueryExecutionManager) iConfigurationElement.createExecutableExtension(_QUERY_CUSTOM_EXECUTION_MANAGER_CLASS__ATTR_NAME);
+ execManager = createTypedInstance(iConfigurationElement, _QUERY_CUSTOM_EXECUTION_MANAGER_CLASS__ATTR_NAME, ICustomQueryExecutionManager.class);
+ _availableCustomQueryExecutionManager.put(queryClassFQN, execManager);
+ }
+ }
+
+ /**
+ * The default Query Execution Manager. It knows how to execute query implementing {@link IQuery} interface.
+ *
+ * Each query execution is done in an run exclusive mode by using a {@link TransactionalEditingDomain}. This
+ * will ensure a read lock of model.
+ *
+ * If there is no Editing domain available for <code>currentElement_p</code>, the query will be executed by
+ * using its run method.
+ *
+ * @param runnable_p
+ * @param currentElement_p
+ * @return
+ * @throws InterruptedException
+ */
+ private void defaultQueryExecution(RunnableWithResult runnable_p, Object currentElement_p) throws InterruptedException{
+ if (currentElement_p instanceof EObject)
+ {
+ EObject e_currentElement_p = (EObject) currentElement_p;
+ Resource eResource = e_currentElement_p.eResource();
+ if (null == eResource)
+ return ;
+
+ ResourceSet resourceSet = eResource.getResourceSet();
+ if (null == resourceSet)
+ return ;
+
+ TransactionalEditingDomain editingDomain_p = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(resourceSet);
+
+ if (editingDomain_p != null)
+ {
+ if (editingDomain_p != null)
+ {
+ editingDomain_p.runExclusive(runnable_p);
+ }
+ }
+ else
+ {
+ runnable_p.run();
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ExplorerElementUtil.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ExplorerElementUtil.java
new file mode 100644
index 0000000..e2f6f76
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ExplorerElementUtil.java
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.util;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Is this class used anywhere ?
+ * @deprecated
+ */
+public class ExplorerElementUtil {
+ /**
+ * FIXME : the element can be moved in the transaction! in this case just do a refresh.
+ * Takes as input an element, and a list of notifications (that of the emf transaction).
+ * and determines whether the element passed as parameter is destroyed or not.
+ * @param rootElement_p
+ * @param notifications_p
+ * @return true if element is destroyed.
+ */
+ @SuppressWarnings("unchecked")
+ public static boolean isDestroyed(EObject rootElement_p, List<Notification> notifications_p) {
+ try {
+ List<EObject> list = new LinkedList<EObject>();
+ // include itself in the result.
+ list.add(rootElement_p);
+ List<EObject> parents = getParents(list, rootElement_p);
+ for (Notification notification : notifications_p) {
+ EStructuralFeature feature = (EStructuralFeature) notification.getFeature();
+ if (feature instanceof EReference) {
+ Object objectToLink = notification.getNewValue();
+ Object formerObject = notification.getOldValue();
+ switch (notification.getEventType()) {
+ case Notification.SET:
+ // relation 0..1. Unset = set(null).
+ case Notification.ADD:
+ // shouldn't had null but in case it arrives...
+ if (null == objectToLink) {
+ if (null != formerObject) {
+ if (parents.contains(formerObject)) {
+ return true;
+ }
+ }
+ }
+ break;
+ case Notification.REMOVE:
+ // relation 0..*
+ // check if the old value is among parents of root element_p.
+ if (parents.contains(formerObject)) {
+ return true;
+ }
+ break;
+ case Notification.REMOVE_MANY:
+ // relation 0..* with multiple objects to remove.
+ Collection<EObject> children = (Collection<EObject>) notification.getOldValue();
+ // // check if one of old values is among parents of root element_p.
+ for (EObject child : children) {
+ if (parents.contains(child))
+ return true;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+ }
+ return false;
+ } catch (NoSuchElementException exception_p) {
+ return false;
+ }
+ }
+
+ /**
+ * Gather parents of an element.
+ * @param parents_p
+ * @param rootElement_p
+ * @return list of parents ordered from the closest to the farest.
+ */
+ public static List<EObject> getParents(List<EObject> parents_p, EObject rootElement_p) {
+ EObject parent = rootElement_p.eContainer();
+ if (parent == null)
+ return parents_p;
+ parents_p.add(parent);
+ return getParents(parents_p, parent);
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ImageUtils.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ImageUtils.java
new file mode 100644
index 0000000..970144a
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ImageUtils.java
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.util;
+
+import org.eclipse.amalgam.explorer.contextual.core.ExplorerActivator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class ImageUtils {
+
+ /** Category image id used in Contextual Explorer.<br> **/
+ public final static String IMG_CATEGORY = "packd_obj.gif"; //$NON-NLS-1$
+
+ /** Default Image path. **/
+ public static final String ICONS_FOLDER_PATH = "icons/"; //$NON-NLS-1$
+
+ /**
+ * @param imagePath path of the image file
+ * @return{@link Image} object
+ */
+ public static Image getImage(String imagePath) {
+ ImageRegistry imageRegistry = ExplorerActivator.getDefault().getImageRegistry();
+ Image image = imageRegistry.get(imagePath);
+ if (null == image)
+ {
+ ImageDescriptor imageDescriptor =
+ AbstractUIPlugin.imageDescriptorFromPlugin(ExplorerActivator.PLUGIN_ID, ICONS_FOLDER_PATH + imagePath);
+
+ imageRegistry.put(imagePath, imageDescriptor);
+ image = imageRegistry.get(imagePath);
+ }
+ return image;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ViewerHelper.java b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ViewerHelper.java
new file mode 100644
index 0000000..31b7eee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.core/src/org/eclipse/amalgam/explorer/contextual/core/util/ViewerHelper.java
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.core.util;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Copied from <code>org.polarsys.capella.common.ui.services.helper.ViewerHelper</code>
+ */
+public class ViewerHelper {
+ /**
+ * Refresh in an efficient way the specified viewer completely with information freshly obtained from this viewer's model.
+ * @param viewer_p
+ */
+ public static void refresh(StructuredViewer viewer_p) {
+ refresh(viewer_p, true);
+ }
+
+ /**
+ * Refresh in an efficient way the specified viewer completely with information freshly obtained from this viewer's model.<br>
+ * If <code>updateLabels_p</code> is <code>true</code> then labels for otherwise unaffected elements are updated as well.<br>
+ * Otherwise, it assumes labels for existing elements are unchanged, and labels are only obtained as needed (for example, for new elements).
+ * <p>
+ * Calling <code>refresh(viewer, true)</code> has the same effect as <code>refresh(viewer)</code>.
+ * <p>
+ * Note that the implementation may still obtain labels for existing elements even if <code>updateLabels</code> is false. The intent is simply to allow
+ * optimization where possible.
+ * @param updateLabels <code>true</code> to update labels for existing elements, <code>false</code> to only update labels as needed, assuming that labels for
+ * existing elements are unchanged.
+ * @param viewer_p
+ * @param updateLabels_p
+ */
+ public static void refresh(final StructuredViewer viewer_p, final boolean updateLabels_p) {
+ run(viewer_p, new Runnable() {
+ /**
+ * {@inheritDoc}
+ */
+ public void run() {
+ viewer_p.refresh(updateLabels_p);
+ }
+ });
+ }
+ /**
+ * Run a {@link Runnable} in an efficient way operation against specified viewer.
+ * @param viewer_p
+ * @param runnable_p
+ */
+ public static void run(StructuredViewer viewer_p, Runnable runnable_p) {
+ // Pre-condition.
+ if (null == viewer_p) {
+ return;
+ }
+ // Get the related control.
+ Control control = viewer_p.getControl();
+ try {
+ // Switch off redraw
+ if (!control.isDisposed()) {
+ control.setRedraw(false);
+ }
+ runnable_p.run();
+ } finally {
+ // Finally, redraw again.
+ if (!control.isDisposed()) {
+ control.setRedraw(true);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.classpath b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.classpath
new file mode 100644
index 0000000..b1dabee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.project b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.project
new file mode 100644
index 0000000..008da2e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.sirius.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..66f6492
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.amalgam.explorer.contextual.sirius.ui;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.amalgam.explorer.contextual.sirius.ui.Activator
+Require-Bundle: org.eclipse.emf.ecore,
+ org.eclipse.amalgam.explorer.contextual.core.ui,
+ org.eclipse.core.expressions,
+ org.eclipse.amalgam.explorer.contextual.core,
+ org.eclipse.amalgam.explorer.contextual,
+ org.eclipse.sirius.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.sirius.table.ui
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Localization: plugin
+Export-Package: org.eclipse.amalgam.explorer.contextual.sirius.ui,
+ org.eclipse.amalgam.explorer.contextual.sirius.ui.actions,
+ org.eclipse.amalgam.explorer.contextual.sirius.ui.focus,
+ org.eclipse.amalgam.explorer.contextual.sirius.ui.handlers
+Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/about.html b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/about.html
new file mode 100644
index 0000000..c9aa915
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/build.properties b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/build.properties
new file mode 100644
index 0000000..524ad58
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/build.properties
@@ -0,0 +1,18 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.properties b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.properties
new file mode 100644
index 0000000..c845958
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.properties
@@ -0,0 +1,16 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+#Properties file for org.eclipse.amalgam.explorer.contextual.sirius.ui
+pluginName=Amalgam Contextual Explorer - Sirius UI integration (Incubation)
+providerName=www.eclipse.org
+
+openRepresentationAction=Open Sirius Representation
+showSiriusRepresentationAction=Show diagrams and Tables in the Contextual Explorer
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.xml b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.xml
new file mode 100644
index 0000000..65d5e2d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/plugin.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.amalgam.explorer.contextual.sirius.ui.handlers.OpenDiagramHandler"
+ id="org.eclipse.amalgam.explorer.contextual.sirius.ui.command.openRepresentationCommand"
+ name="%openRepresentationAction">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.viewActions">
+ <viewContribution
+ id="org.eclipse.amalgam.explorer.contextual.sirius.ui.viewerContribution.showHideDiagramAndTable"
+ targetID="org.eclipse.amalgam.explorer.contextual.view.ExplorerContextualID">
+ <action
+ class="org.eclipse.amalgam.explorer.contextual.sirius.ui.actions.ShowHideSiriusRepresentations"
+ icon="platform:/plugin/org.eclipse.sirius.common.ui/icons/LinkToSirius.gif"
+ id="org.eclipse.amalgam.explorer.contextual.sirius.ui.actions.ShowHideSiriusRepresentations"
+ label="%showSiriusRepresentationAction"
+ state="true"
+ style="toggle"
+ toolbarPath="additions"
+ tooltip="%showSiriusRepresentationAction">
+ </action>
+ </viewContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.amalgam.explorer.contextual.view.ExplorerContextualID?after=additions">
+ <command
+ commandId="org.eclipse.amalgam.explorer.contextual.sirius.ui.command.openRepresentationCommand"
+ icon="platform:/plugin/org.eclipse.sirius.common.ui/icons/LinkToSirius.gif"
+ id="org.eclipse.amalgam.explorer.contextual.sirius.ui.menu.openRepresentation"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <and>
+ <iterate>
+ <instanceof
+ value="org.eclipse.sirius.viewpoint.DRepresentation">
+ </instanceof>
+ </iterate>
+ <count
+ value="1">
+ </count>
+ </and>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.amalgam.explorer.contextual.FocusInEditor">
+ <focusManager
+ class="org.eclipse.amalgam.explorer.contextual.sirius.ui.focus.FocusInDiagramEditor">
+ </focusManager>
+ <focusManager
+ class="org.eclipse.amalgam.explorer.contextual.sirius.ui.focus.FocusInTableEditor">
+ </focusManager>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/Activator.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/Activator.java
new file mode 100644
index 0000000..7a16199
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/Activator.java
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.amalgam.explorer.contextual.sirius.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/actions/ShowHideSiriusRepresentations.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/actions/ShowHideSiriusRepresentations.java
new file mode 100644
index 0000000..e5460e8
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/actions/ShowHideSiriusRepresentations.java
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.ui.actions;
+
+import org.eclipse.amalgam.explorer.contextual.core.model.IExplorerContextualModel;
+import org.eclipse.amalgam.explorer.contextual.core.ui.action.AbstractShowHideAction;
+
+/**
+ *
+ */
+public class ShowHideSiriusRepresentations extends AbstractShowHideAction {
+
+ /** Sirius Diagrams category name **/
+ private static final String DIAGRAM_CATEGORY_NAME = "Related Sirius Diagrams"; //$NON-NLS-1$
+
+ /** Sirius Tables category name **/
+ private static final String TABLE_CATEGORY_NAME = "Related Sirius Tables"; //$NON-NLS-1$
+
+
+ /*
+ * (non-Javadoc)
+ * @see oorg.eclipse.amalgam.explorer.contextual.core.ui.action.AbstractShowHideAction#changeCategoriesStates(boolean)
+ */
+ @Override
+ public void changeCategoriesStates(boolean state_p, IExplorerContextualModel model_p) {
+ model_p.setCategoryShowState(DIAGRAM_CATEGORY_NAME, state_p);
+ model_p.setCategoryShowState(TABLE_CATEGORY_NAME, state_p);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.core.ui.action.AbstractShowHideAction#getInitialState()
+ */
+ @Override
+ public boolean getInitialState() {
+ return true;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInDiagramEditor.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInDiagramEditor.java
new file mode 100644
index 0000000..66e6644
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInDiagramEditor.java
@@ -0,0 +1,208 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.ui.focus;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.DDiagramElement;
+import org.eclipse.sirius.diagram.DSemanticDiagram;
+import org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery;
+import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramEdgeEditPart;
+import org.eclipse.sirius.diagram.ui.part.SiriusDiagramEditor;
+import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor;
+import org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+import org.eclipse.sirius.viewpoint.DSemanticDecorator;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ */
+public class FocusInDiagramEditor implements IFocusInEditor {
+ /** The opened diagram editor **/
+ private SiriusDiagramEditor _diagramEditor = null;
+
+ /** **/
+ private IDiagramGraphicalViewer _diagramGraphicalViewer;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor#accept(org.eclipse.ui.IEditorPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean accept(IEditorPart activeEditor_p, ISelection selection_p) {
+ Object firstElement = ((IStructuredSelection) selection_p).getFirstElement();
+ boolean selectableElement = (firstElement instanceof EObject) && (false == firstElement instanceof DRepresentation);
+ return activeEditor_p instanceof DDiagramEditor && selectableElement;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor#focusInEditor(org.eclipse.ui.IEditorPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean focusInEditor(IEditorPart activeEditor_p, ISelection selection_p) {
+ initdiagramEditor();
+ Object firstElement = ((IStructuredSelection)selection_p).getFirstElement();
+ DSemanticDecorator views = getView((EObject) firstElement);
+ boolean result = true;
+ if (null != views)
+ {
+ result = selectViewsInEditor(views);
+ }
+ else
+ {
+ result = false;
+ }
+ _diagramEditor = null;
+ _diagramGraphicalViewer = null;
+ return result;
+ }
+
+
+ /**
+ * Find a {@link DSemanticDecorator} in the current open diagram editor.
+ * @param semantic_p the selected {@link EObject} element in the Contextual Explorer View.
+ * @return If it exists, the corresponding {@link DSemanticDecorator} available in the opened diagram editor.
+ */
+ protected DSemanticDecorator getView(EObject semantic_p) {
+ if (null != _diagramEditor)
+ {
+ DSemanticDiagram diagram = (DSemanticDiagram) _diagramEditor.getDiagram().getElement();
+ EList<DRepresentationElement> representationElements = diagram.getRepresentationElements();
+ for (DRepresentationElement dRepresentationElement : representationElements)
+ {
+ EObject target = dRepresentationElement.getTarget();
+ if (EcoreUtil.equals(target, semantic_p))
+ return dRepresentationElement;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Focus on the <code>view_p</code>.
+ * @param view_p a {@link DSemanticDecorator} to focus on in the current open diagram editor.
+ */
+ protected boolean selectViewsInEditor(DSemanticDecorator view_p){
+ if (view_p == null)
+ {
+ //ShowInDiagramAction_UnknownElement_Message
+ return false;
+ }
+ else
+ {
+ if (view_p instanceof DDiagramElement)
+ {
+ DDiagramElementQuery query = new DDiagramElementQuery((DDiagramElement) view_p);
+ if (query.isFolded() || query.isHidden() || query.isCollapsed() || query.isFiltered())
+ {
+ return false;
+ }
+
+ IGraphicalEditPart selectedPart = getGraphicalPart(view_p);
+ if (null == selectedPart)
+ {
+ return false;
+ }
+ else
+ {
+ _diagramGraphicalViewer.select(selectedPart);
+ _diagramGraphicalViewer.reveal(selectedPart);
+ return true;
+ }
+ }
+ else
+ {
+ if (view_p instanceof DDiagram)
+ {
+ // ShowInDiagramAction_UnknownElement_Message);
+ }
+ return false;
+ }
+ }
+ }
+
+ /**
+ * @param view_p a {@link DSemanticDecorator} to focus on in the current open diagram editor.
+ * @return the <code>view_p</code> corresponding {@link IGraphicalEditPart}
+ */
+ protected IGraphicalEditPart getGraphicalPart(DSemanticDecorator view_p) {
+ //A crossReferencer should be enough to retrieve these elements, but in some buggy case, 2 GMF diagrams for one DDiagram
+ IGraphicalEditPart graphicalEditPart = null;
+ if (null != _diagramEditor)
+ {
+ // Check it is a Sirius one.
+ if (_diagramGraphicalViewer instanceof IDiagramDialectGraphicalViewer)
+ {
+ IDiagramDialectGraphicalViewer dialectViewer = (IDiagramDialectGraphicalViewer) _diagramGraphicalViewer;
+ // Search all edit parts linked to selected object.
+ List<IGraphicalEditPart> editParts = dialectViewer.findEditPartsForElement(view_p.getTarget(), IGraphicalEditPart.class);
+ // Iterate over retrieved edit parts to remove the ones related to 'label' edit part.
+ for (Iterator<IGraphicalEditPart> iterator = editParts.iterator(); iterator.hasNext();)
+ {
+ IGraphicalEditPart editPart = iterator.next();
+ // Filter out label edit part.
+
+ if (false == editPart.isSelectable())
+ {
+ iterator.remove();
+ }
+ }
+
+ if (editParts.size() == 1)
+ {
+ // Select directly this one.
+ graphicalEditPart = editParts.get(0);
+ }
+ else
+ {
+ // Multiple edit parts are found.
+ // In some cases, 2 UI representations can point to the same target e.g an DEdge and a AbstractDNode.
+ // Priority is done to the AbstractDNode vs an DEdge.
+ for (IGraphicalEditPart currentGraphicalEditPart : editParts)
+ {
+ if (!(currentGraphicalEditPart instanceof IDiagramEdgeEditPart))
+ {
+ graphicalEditPart = currentGraphicalEditPart;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return graphicalEditPart;
+ }
+
+ /**
+ * initialize {@link #_diagramEditor} and {@link #_diagramGraphicalViewer} properties.
+ */
+ private void initdiagramEditor(){
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if ((null != activeEditor) && (activeEditor instanceof SiriusDiagramEditor))
+ {
+ _diagramEditor = (SiriusDiagramEditor) activeEditor;
+ _diagramGraphicalViewer = _diagramEditor.getDiagramGraphicalViewer();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInTableEditor.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInTableEditor.java
new file mode 100644
index 0000000..4cce6b0
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/focus/FocusInTableEditor.java
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.ui.focus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.sirius.table.metamodel.table.DLine;
+import org.eclipse.sirius.table.metamodel.table.DTable;
+import org.eclipse.sirius.table.metamodel.table.LineContainer;
+import org.eclipse.sirius.table.ui.tools.internal.editor.DTableEditionEditor;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ */
+@SuppressWarnings("restriction")
+public class FocusInTableEditor implements IFocusInEditor {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor#accept(org.eclipse.ui.IEditorPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean accept(IEditorPart activeEditor_p, ISelection selection_p) {
+ Object firstElement = ((IStructuredSelection) selection_p).getFirstElement();
+ boolean selectableElement = (firstElement instanceof EObject) && (false == firstElement instanceof DRepresentation);
+ return activeEditor_p instanceof DTableEditionEditor && selectableElement;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor#focusInEditor(org.eclipse.ui.IEditorPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean focusInEditor(IEditorPart activeEditor_p, ISelection selection_p) {
+ DTableEditionEditor tableEditor = (DTableEditionEditor) activeEditor_p;
+ DRepresentation representation = tableEditor.getRepresentation();
+ if (representation instanceof DTable)
+ {
+ DTable table = (DTable) representation;
+ EList<DRepresentationElement> tableElements = table.getRepresentationElements();
+ for (DRepresentationElement dRepresentationElement : tableElements)
+ {
+ if (dRepresentationElement instanceof DLine)
+ {
+ DLine dLine = (DLine) dRepresentationElement;
+ EObject target = dLine.getTarget();
+ IStructuredSelection selection = (IStructuredSelection) selection_p;
+ Object selectionElement = selection.getFirstElement();
+ if (null != selectionElement && EcoreUtil.equals(target, (EObject) selectionElement))
+ {
+ if (dLine.isVisible())
+ {
+ // 1. Construct a List containing all parents of the selected DLine
+ List<Object> parents = new ArrayList<Object>();
+ parents.add(dLine);
+ while (null != dLine.getContainer())
+ {
+ LineContainer lineContainer = dLine.getContainer();
+ if (lineContainer instanceof DLine)
+ {
+ // Continue to loop over parents
+ dLine = (DLine) lineContainer;
+ parents.add(0, dLine);
+ }
+ else
+ {
+ // Break the while loop because current element in not a DLine. this means
+ // that the element a DTableSpec object
+ break;
+ }
+ }
+
+ // 2. Create a TreePath containing all parents of the selected DLine
+ TreePath treePath = new TreePath(parents.toArray());
+ // 3. Create a TreeSelection.
+ TreeSelection treeSelection = new TreeSelection(treePath);
+ // 4. Fire selection and reveal of the selected DLine
+ tableEditor.getTableViewer().setSelection(treeSelection, true);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/handlers/OpenDiagramHandler.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/handlers/OpenDiagramHandler.java
new file mode 100644
index 0000000..012df20
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius.ui/src/org/eclipse/amalgam/explorer/contextual/sirius/ui/handlers/OpenDiagramHandler.java
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.ui.handlers;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ExplorerContextualView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionManager;
+import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.sirius.viewpoint.DSemanticDecorator;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+
+public class OpenDiagramHandler extends AbstractHandler {
+
+ /** Current selected diagram. **/
+ private ISelection _selection;
+
+ /** Contextual Explorer view. **/
+ private ExplorerContextualView _explorerContextualView;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ boolean init = init(event);
+ if (init)
+ {
+ opendiagram();
+ }
+
+ return null;
+ }
+
+ public void opendiagram(){
+ IStructuredSelection structuredSelection = (IStructuredSelection) _selection;
+ // This action is only available for DSemanticDiagram with at least one element.
+ DRepresentation representation = (DRepresentation) structuredSelection.getFirstElement();
+ // Deactivate listening events during diagram opening since the open editor will change it to something that is not the end-user concern.
+ boolean listeningToPageSelectionEvents = ExplorerContextualView.isListeningToPageSelectionEvents();
+ EObject target = getTarget(representation);
+ if (null != target)
+ {
+ try
+ {
+ if (listeningToPageSelectionEvents)
+ {
+ _explorerContextualView.deactivateListeningToPageSelectionEvents();
+ }
+ Session session = SessionManager.INSTANCE.getSession(target);
+ IEditorPart openEditor = DialectUIManager.INSTANCE.openEditor(session, representation, new NullProgressMonitor());
+
+ if (null == openEditor)
+ {
+ // Log an Error message
+ }
+
+ }
+ finally
+ {
+ // Enable again the listening if needed.
+ if (listeningToPageSelectionEvents)
+ {
+ _explorerContextualView.activateListeningToPageSelectionEvents();
+ }
+ }
+ }
+ }
+
+ public boolean init(ExecutionEvent event_p){
+ Object applicationContext = event_p.getApplicationContext();
+ if (applicationContext instanceof IEvaluationContext)
+ {
+ IEvaluationContext evaluationContext = (IEvaluationContext) applicationContext;
+ Object variable = evaluationContext.getVariable("activePart");
+ if (variable instanceof IViewPart && variable instanceof ExplorerContextualView)
+ {
+ _explorerContextualView = (ExplorerContextualView) variable;
+ _selection = _explorerContextualView.getSite().getSelectionProvider().getSelection();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected EObject getTarget(EObject representation){
+ if (representation instanceof DRepresentation)
+ {
+ DSemanticDecorator sDecorator = (DSemanticDecorator) representation;
+ return sDecorator.getTarget();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.classpath b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.classpath
new file mode 100644
index 0000000..b1dabee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.project b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.project
new file mode 100644
index 0000000..43c75f5
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual.sirius</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5210d65
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.amalgam.explorer.contextual.sirius;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.amalgam.explorer.contextual.sirius.Activator
+Require-Bundle: org.eclipse.gef,
+ org.eclipse.amalgam.explorer.contextual.core.ui,
+ org.eclipse.sirius.diagram,
+ org.eclipse.sirius.table,
+ org.eclipse.gmf.runtime.notation
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.amalgam.explorer.contextual.sirius,
+ org.eclipse.amalgam.explorer.contextual.sirius.queries,
+ org.eclipse.amalgam.explorer.contextual.sirius.selection
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/about.html b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/about.html
new file mode 100644
index 0000000..c9aa915
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/build.properties b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/build.properties
new file mode 100644
index 0000000..c7cdf33
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/build.properties
@@ -0,0 +1,18 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.properties b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.properties
new file mode 100644
index 0000000..cb7313d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.properties
@@ -0,0 +1,13 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+#Properties file for org.eclipse.amalgam.explorer.contextual.sirius
+pluginName=Amalgam Contextual Explorer - Sirius integration (Incubation)
+providerName=www.eclipse.org
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.xml b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.xml
new file mode 100644
index 0000000..c43d022
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/plugin.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.amalgam.explorer.contextual.core.ui.selectionHelper">
+ <helper
+ class="org.eclipse.amalgam.explorer.contextual.sirius.selection.SiriusSelectionHelper"
+ id="Default Sirius Selection Helper">
+ </helper>
+ </extension>
+ <extension
+ point="org.eclipse.amalgam.explorer.contextual.core.contentProviderCategory">
+ <category
+ id="org.eclipse.amalgam.explorer.contextual.sirius.category.relateddiagrams"
+ isTopLevel="true"
+ name="All Related Diagrams">
+ <availableForType
+ class="org.eclipse.emf.ecore.EObject">
+ </availableForType>
+ <targetExplorerId
+ id="CurrentElementExplorer">
+ </targetExplorerId>
+ <categoryQuery>
+ <basicQuery
+ class="org.eclipse.amalgam.explorer.contextual.sirius.queries.RelatedDiagramsQuery">
+ </basicQuery>
+ </categoryQuery>
+ </category>
+ <category
+ id="org.eclipse.amalgam.explorer.contextual.sirius.category.relatedtables"
+ isTopLevel="true"
+ name="All Related Tables">
+ <availableForType
+ class="org.eclipse.emf.ecore.EObject">
+ </availableForType>
+ <targetExplorerId
+ id="CurrentElementExplorer">
+ </targetExplorerId>
+ <categoryQuery>
+ <basicQuery
+ class="org.eclipse.amalgam.explorer.contextual.sirius.queries.RelatedTableQuery">
+ </basicQuery>
+ </categoryQuery>
+ </category>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/Activator.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/Activator.java
new file mode 100644
index 0000000..81156a8
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/Activator.java
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.amalgam.explorer.contextual.sirius"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/AbstractRepresentationQuery.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/AbstractRepresentationQuery.java
new file mode 100644
index 0000000..29c468d
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/AbstractRepresentationQuery.java
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.queries;
+
+import java.util.Collection;
+
+import org.eclipse.amalgam.explorer.contextual.core.query.IQuery;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.sirius.business.api.dialect.DialectManager;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.business.api.session.SessionManager;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+
+/**
+ *
+ */
+public abstract class AbstractRepresentationQuery implements IQuery{
+
+ /** Sirius representation file extension. **/
+ protected static final String _AIRD_FILE_EXTENSION = "aird";
+
+ /**
+ * @param representation_p
+ * @param element_p
+ * @return True by default. Derived classes can override this method to control
+ * displaying the representation or not
+ */
+ protected boolean isElementVisibleInRepresentation(DRepresentation representation_p, DRepresentationElement element_p){
+ return true;
+ }
+ /**
+ *
+ * @param element_p
+ * @param session_p
+ * @return
+ */
+ protected Collection<DRepresentation> getAllRepresentation(EObject element_p, Session session_p){
+ Collection<DRepresentation> representations = DialectManager.INSTANCE.getRepresentations(element_p, session_p);
+ Collection<DRepresentation> allRepresentations = DialectManager.INSTANCE.getAllRepresentations(session_p);
+ for (DRepresentation dRepresentation : allRepresentations)
+ {
+ EList<DRepresentationElement> representationElements = dRepresentation.getRepresentationElements();
+ for (DRepresentationElement dRepresentationElement : representationElements)
+ {
+ if (EcoreUtil.equals(dRepresentationElement.getTarget(), element_p))
+ {
+ if (isElementVisibleInRepresentation(dRepresentation, dRepresentationElement))
+ {
+ representations.add(dRepresentation);
+ break;
+ }
+ }
+ }
+ }
+ return representations;
+ }
+
+ /**
+ * Return a candidate session for a given {@link EObject}
+ * @param eObject_p an {@link EObject}
+ * @return {@link Session} if it exist, null otherwise.
+ */
+ protected Session getSession(EObject eObject_p){
+ Session session = SessionManager.INSTANCE.getSession(eObject_p);
+
+ if (null == session)
+ {// Try the get a session for a representation file sharing the same name of the resource containing object_p
+// URI uri = eObject_p.eResource().getURI().trimFileExtension().appendFileExtension(_AIRD_FILE_EXTENSION);
+// session = SessionManager.INSTANCE.getSession(uri, new NullProgressMonitor());
+
+ Collection<Session> sessions = SessionManager.INSTANCE.getSessions();
+ for (Session iSession : sessions)
+ {
+ Collection<Resource> sResources = iSession.getSemanticResources();
+ for (Resource iResource : sResources)
+ {
+ TreeIterator<EObject> allContents = iResource.getAllContents();
+ while (allContents.hasNext())
+ {
+ EObject eObject = (EObject) allContents.next();
+ if (EcoreUtil.equals(eObject, eObject_p))
+ return iSession;
+ }
+ }
+ }
+ }
+ return session;
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedDiagramsQuery.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedDiagramsQuery.java
new file mode 100644
index 0000000..041c714
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedDiagramsQuery.java
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.queries;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.diagram.DDiagramElement;
+import org.eclipse.sirius.diagram.DSemanticDiagram;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+
+/**
+ *
+ */
+public class RelatedDiagramsQuery extends AbstractRepresentationQuery {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.core.query.IQuery#compute(java.lang.Object)
+ */
+ @Override
+ public List<Object> compute(Object object_p) {
+ List<Object> result = new ArrayList<Object>();
+ if (object_p instanceof EObject)
+ {
+ EObject eObject = (EObject) object_p;
+ Session session = getSession(eObject);
+
+ if (null != session && session.isOpen())
+ {// There is an open session containing the object_p
+ Collection<DRepresentation> allRepresentation = getAllRepresentation(eObject, session);
+ if (allRepresentation != null && allRepresentation.isEmpty() == false)
+ {
+ for (DRepresentation dRepresentation : allRepresentation)
+ {
+ if (dRepresentation instanceof DSemanticDiagram)
+ {
+ result.add(dRepresentation);
+ }
+ }
+ }
+ }
+ else
+ {// There is no open session containing the object_p
+
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.amalgam.explorer.contextual.sirius.queries.AbstractRepresentationQuery#isElementVisibleInRepresentation(org.eclipse.sirius.viewpoint.DRepresentation, org.eclipse.sirius.viewpoint.DRepresentationElement)
+ */
+ @Override
+ protected boolean isElementVisibleInRepresentation(DRepresentation representation_p, DRepresentationElement element_p) {
+ // check if a diagram element is visible. This means that is owning layer is active
+ if (representation_p instanceof DSemanticDiagram && element_p instanceof DDiagramElement)
+ {
+ DDiagramElement diagramElement = (DDiagramElement) element_p;
+ return diagramElement.isVisible();
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedTableQuery.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedTableQuery.java
new file mode 100644
index 0000000..b26ef4a
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/queries/RelatedTableQuery.java
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.queries;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.table.metamodel.table.DTable;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+
+/**
+ *
+ */
+public class RelatedTableQuery extends AbstractRepresentationQuery {
+
+ @Override
+ public List<Object> compute(Object object_p) {
+ List<Object> result = new ArrayList<Object>();
+ if (object_p instanceof EObject)
+ {
+ EObject eObject = (EObject) object_p;
+ Session session = getSession(eObject);
+
+ if (null != session)
+ {// There is an open session containing the object_p
+ Collection<DRepresentation> allRepresentation = getAllRepresentation(eObject, session);
+ if (allRepresentation != null && allRepresentation.isEmpty() == false)
+ {
+ for (DRepresentation dRepresentation : allRepresentation)
+ {
+ if (dRepresentation instanceof DTable)
+ {
+ result.add(dRepresentation);
+ }
+ }
+ }
+ }
+ else
+ {// There is no open session containing the object_p
+
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/selection/SiriusSelectionHelper.java b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/selection/SiriusSelectionHelper.java
new file mode 100644
index 0000000..e459210
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual.sirius/src/org/eclipse/amalgam/explorer/contextual/sirius/selection/SiriusSelectionHelper.java
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.sirius.selection;
+
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ext.ISelectionHelper;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+import org.eclipse.sirius.viewpoint.DSemanticDecorator;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class SiriusSelectionHelper implements ISelectionHelper{
+
+ @Override
+ public Object getSelection(IWorkbenchPart part_p, ISelection selection_p, Object selectedObject) {
+ Object result = null;
+ if (selectedObject instanceof EditPart)
+ {
+ // Selection of a graphical element in a GMF-based diagram editor.
+ EditPart selectedEditPart = (EditPart) selectedObject;
+ View view = (View) selectedEditPart.getModel();
+ if (view.getElement() instanceof DSemanticDecorator)
+ {
+ DSemanticDecorator diagram = (DSemanticDecorator) view.getElement();
+ if (null != diagram)
+ {
+ // diagram may be null when there is a note in the diagram
+ // So here, there is a test to check whether this instance is null or not
+ result = diagram.getTarget();
+ }
+ }
+ }
+ else
+ {
+ if (selectedObject instanceof DSemanticDecorator)
+ {
+ DSemanticDecorator vpe = (DSemanticDecorator) selectedObject;
+ result = vpe.getTarget();
+ }
+ else
+ {
+ if (selectedObject instanceof DRepresentationElement)
+ {
+ DRepresentationElement vpe = (DRepresentationElement) selectedObject;
+ List<EObject> elements = vpe.getSemanticElements();
+ for (EObject element : elements)
+ result = element;
+ }
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/.classpath b/plugins/org.eclipse.amalgam.explorer.contextual/.classpath
new file mode 100644
index 0000000..b1dabee
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/.project b/plugins/org.eclipse.amalgam.explorer.contextual/.project
new file mode 100644
index 0000000..0e25afd
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.amalgam.explorer.contextual</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.amalgam.explorer.contextual/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..11f6e46
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.contextual/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a0a4755
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.amalgam.explorer.contextual;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.amalgam.explorer.contextual.Activator
+Require-Bundle: org.eclipse.amalgam.explorer.contextual.core.ui,
+ org.eclipse.sirius,
+ org.eclipse.core.expressions
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Localization: plugin
+Export-Package: org.eclipse.amalgam.explorer.contextual,
+ org.eclipse.amalgam.explorer.contextual.view,
+ org.eclipse.amalgam.explorer.contextual.view.focus,
+ org.eclipse.amalgam.explorer.contextual.view.handlers
+Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/about.html b/plugins/org.eclipse.amalgam.explorer.contextual/about.html
new file mode 100644
index 0000000..c9aa915
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/build.properties b/plugins/org.eclipse.amalgam.explorer.contextual/build.properties
new file mode 100644
index 0000000..801a315
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/build.properties
@@ -0,0 +1,20 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ icons/,\
+ schema/
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/icons/focusIneditor.png b/plugins/org.eclipse.amalgam.explorer.contextual/icons/focusIneditor.png
new file mode 100644
index 0000000..5282d82
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/icons/focusIneditor.png
Binary files differ
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/icons/license.txt b/plugins/org.eclipse.amalgam.explorer.contextual/icons/license.txt
new file mode 100644
index 0000000..7813e5e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/icons/license.txt
@@ -0,0 +1,7 @@
+These followings icons are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+<icon file path> - <original eclipse plug-in> - <original file path>
+
+/icons/focusIneditor.png - org.eclipse.amalgam.explorer.contextual - org.eclipse.amalgam.explorer.contextual/icons/focusIneditor.png
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/plugin.properties b/plugins/org.eclipse.amalgam.explorer.contextual/plugin.properties
new file mode 100644
index 0000000..9be79f4
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/plugin.properties
@@ -0,0 +1,16 @@
+# =============================================================================
+# Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Thales - initial API and implementation
+# =============================================================================
+#Properties file for org.eclipse.amalgam.explorer.contextual
+pluginName=Amalgam Contextual Explorer (Incubation)
+providerName=www.eclipse.org
+
+explorerContextualView_name=Contextual Explorer
+selectInCurrentEditor_name=Select in open editor
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/plugin.xml b/plugins/org.eclipse.amalgam.explorer.contextual/plugin.xml
new file mode 100644
index 0000000..d9b0c4b
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/plugin.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<plugin>
+ <extension-point id="FocusInEditor" name="FocusInEditor" schema="schema/FocusInEditor.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.amalgam.view.category"
+ name="Amalgam">
+ </category>
+ <view
+ allowMultiple="false"
+ category="org.eclipse.amalgam.view.category"
+ class="org.eclipse.amalgam.explorer.contextual.view.AmalgamExplorerContextualView"
+ icon="platform:/plugin/org.eclipse.amalgam.explorer.contextual.core.ui/icons/ctxexplorer_16x16.png"
+ id="org.eclipse.amalgam.explorer.contextual.view.ExplorerContextualID"
+ name="%explorerContextualView_name">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.amalgam.explorer.contextual.view.handlers.SelectInCurrentEditorHandler"
+ id="org.eclipse.amalgam.explorer.contextual.command.SelectInCurrentEditorHandler"
+ name="%selectInCurrentEditor_name">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.amalgam.explorer.contextual.view.ExplorerContextualID?after=additions">
+ <command
+ commandId="org.eclipse.amalgam.explorer.contextual.command.SelectInCurrentEditorHandler"
+ icon="icons/focusIneditor.png"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="org.eclipse.amalgam.explorer.contextual.command.SelectInCurrentEditorHandler.active">
+ <equals
+ value="ENABLED">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.services">
+ <sourceProvider
+ provider="org.eclipse.amalgam.explorer.contextual.view.focus.FocusableElementSourceProvider">
+ <variable
+ name="org.eclipse.amalgam.explorer.contextual.command.SelectInCurrentEditorHandler.active"
+ priorityLevel="workbench">
+ </variable>
+ </sourceProvider>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/schema/FocusInEditor.exsd b/plugins/org.eclipse.amalgam.explorer.contextual/schema/FocusInEditor.exsd
new file mode 100644
index 0000000..e05b4a4
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/schema/FocusInEditor.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<!--
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Thales - initial API and implementation
+-->
+<schema targetNamespace="org.eclipse.amalgam.explorer.contextual" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.amalgam.explorer.contextual" id="FocusInEditor" name="FocusInEditor"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="focusManager" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="focusManager">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.amalgam.explorer.contextual.view.focus.IFocusInEditor"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Thales - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/Activator.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/Activator.java
new file mode 100644
index 0000000..f316423
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/Activator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.amalgam.explorer.contextual"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/AmalgamExplorerContextualView.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/AmalgamExplorerContextualView.java
new file mode 100644
index 0000000..e287b3c
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/AmalgamExplorerContextualView.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view;
+
+import java.util.Collection;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ExplorerContextualView;
+import org.eclipse.amalgam.explorer.contextual.view.focus.FocusableElementSelectionListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ *
+ */
+public class AmalgamExplorerContextualView extends ExplorerContextualView{
+
+ /** Unique instance of {@link FocusableElementSelectionListener} **/
+ private static FocusableElementSelectionListener FocusableElementSelectionListener = null;
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Add a {@link FocusableElementSelectionListener} used to control the Focus in open editor command.
+ * </p>
+ */
+ @Override
+ public void activateListeningToPageSelectionEvents() {
+ super.activateListeningToPageSelectionEvents();
+ if (FocusableElementSelectionListener == null)
+ {
+ FocusableElementSelectionListener = new FocusableElementSelectionListener();
+ getSite().getPage().addSelectionListener(FocusableElementSelectionListener);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Activate navigation by double click.
+ * </p>
+ */
+ @Override
+ protected void handleDoubleClickWithCtrlKeyNotPressed(DoubleClickEvent event_p, Object object_p) {
+ super.handleDoubleClickWithCtrlKeyPressed(event_p, object_p);
+ }
+
+ @Override
+ public boolean isSemanticElements(Collection<?> objects_p) {
+ for (Object object : objects_p)
+ {
+ if (false == object instanceof EObject)
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected String getViewIDForSyncAction() {
+ return "org.eclipse.ui.navigator.ProjectExplorer";
+ }
+
+ @Override
+ protected String ingoredViewAsSelectionProvider() {
+ return "org.eclipse.ui.views.PropertySheet";
+ }
+
+ @Override
+ protected Object handleWorkbenchPageSelectionEvent(IWorkbenchPart part_p, ISelection selection_p) {
+ Object result = super.handleWorkbenchPageSelectionEvent(part_p, selection_p);
+
+ if (null == result)
+ {
+ if (!selection_p.isEmpty() && !(part_p instanceof ExplorerContextualView))
+ {
+ if (selection_p instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection_l = (IStructuredSelection) selection_p;
+ Object firstElement = selection_l.getFirstElement();
+ if (firstElement instanceof EObject)
+ {
+ result = firstElement;
+ }
+ else
+ {
+ if (firstElement instanceof EObject)
+ result = firstElement;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusInEditorExtensionsManager.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusInEditorExtensionsManager.java
new file mode 100644
index 0000000..e3b4e32
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusInEditorExtensionsManager.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view.focus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.amalgam.explorer.contextual.Activator;
+import org.eclipse.amalgam.explorer.contextual.core.ext.AbstractExtensionPointManager;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ */
+
+public class FocusInEditorExtensionsManager extends AbstractExtensionPointManager{
+ /** Focus Manager configuration element name. **/
+ private static final String _FOCUSMANAGER_EXTPOINT_ID = "FocusInEditor";
+
+ /** List of all Focus Managers available in the platform .**/
+ private static List<IFocusInEditor> _focusRegistry;
+
+ /** Singleton property **/
+ private static FocusInEditorExtensionsManager _instance = null;
+
+ /**
+ * Singleton getter.
+ * @return a unique {@link FocusInEditorExtensionsManager}
+ */
+ public static FocusInEditorExtensionsManager getInstance(){
+ if (_instance == null)
+ _instance = new FocusInEditorExtensionsManager();
+
+ return _instance;
+ }
+
+ /**
+ * Hidden constructor
+ */
+ protected FocusInEditorExtensionsManager() {
+ _focusRegistry = new ArrayList<IFocusInEditor>();
+ initRegistry();
+ }
+
+ /**
+ * Check if there is a Focus Manager that accepts to handle selection.
+ * @param activeEditor_p
+ * @param selection_p
+ * @return
+ */
+ public boolean accept(IEditorPart activeEditor_p, ISelection selection_p){
+ for (IFocusInEditor iFocusInEditor : _focusRegistry)
+ {
+ boolean accept = iFocusInEditor.accept(activeEditor_p, selection_p);
+ if (accept)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Find a focus manager that accept to do the focus action of the <code>activeEditor_p</code> Editor.
+ * @see IFocusInEditor#focusInEditor(IEditorPart, ISelection)
+ */
+ public boolean doFocus(IEditorPart activeEditor_p, ISelection selection_p){
+ for (IFocusInEditor iFocusInEditor : _focusRegistry)
+ {
+ boolean accept = iFocusInEditor.accept(activeEditor_p, selection_p);
+ if (accept)
+ {
+ return iFocusInEditor.focusInEditor(activeEditor_p, selection_p);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Initialize focus manager Registry
+ */
+ private void initRegistry() {
+ IConfigurationElement[] configurationElements =
+ getConfigurationElementsFor(Activator.PLUGIN_ID, _FOCUSMANAGER_EXTPOINT_ID);
+
+ for (IConfigurationElement iConElement : configurationElements)
+ {
+ IFocusInEditor focusManager = createTypedInstance(iConElement, DEFAULT_CLASS_ATTRIBUTE, IFocusInEditor.class) ;
+ if (focusManager != null)
+ {
+ _focusRegistry.add(focusManager);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSelectionListener.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSelectionListener.java
new file mode 100644
index 0000000..c808451
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSelectionListener.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view.focus;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.services.ISourceProviderService;
+
+/**
+ *
+ */
+public class FocusableElementSelectionListener implements ISelectionListener {
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part_p, ISelection selection_p) {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ISourceProviderService iSourceProviderService =
+ (ISourceProviderService) activeWorkbenchWindow.getService(ISourceProviderService.class);
+
+ FocusableElementSourceProvider focusCommandStateService =
+ (FocusableElementSourceProvider) iSourceProviderService.getSourceProvider(FocusableElementSourceProvider.MY_STATE);
+
+ focusCommandStateService.computeState(part_p, selection_p);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSourceProvider.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSourceProvider.java
new file mode 100644
index 0000000..7d5df8e
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/FocusableElementSourceProvider.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view.focus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ExplorerContextualView;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.AbstractSourceProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ */
+public class FocusableElementSourceProvider extends AbstractSourceProvider {
+
+ /** Can Focus **/
+ public static final String ENABLED = "ENABLED";
+
+ /** Can't Focus **/
+ public static final String DISENABLED = "DISENABLED";
+
+ /** Name of the property used by extension points to track the state **/
+ public static final String MY_STATE = "org.eclipse.amalgam.explorer.contextual.command.SelectInCurrentEditorHandler.active";
+
+ /** Selected object **/
+ private boolean acceptFocusOnSelection;
+
+ /**
+ * Default constructor
+ */
+ public FocusableElementSourceProvider() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.ISourceProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.ISourceProvider#getCurrentState()
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Map getCurrentState() {
+ Map map = new HashMap(1);
+ String value = acceptFocusOnSelection ? ENABLED : DISENABLED;;
+ map.put(MY_STATE, value);
+ return map;
+ }
+
+ /**
+ * returns the properties names used by extension points
+ */
+ @Override
+ public String[] getProvidedSourceNames() {
+ return new String[] { MY_STATE };
+ }
+
+ /**
+ * Listen to selection changes on Contextual Explorer View and check if selected element is focusable.
+ */
+ public void computeState(IWorkbenchPart part_p, ISelection selection_p) {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (null == activeWorkbenchWindow)
+ return;
+
+ IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
+ if (null == page)
+ return;
+
+ IEditorPart activeEditor = (IEditorPart) page.getActiveEditor();
+ if (null == activeEditor)
+ {
+ acceptFocusOnSelection = false;
+ }
+ else
+ {
+ if (!selection_p.isEmpty() && part_p instanceof ExplorerContextualView)
+ {
+ if (selection_p instanceof IStructuredSelection)
+ {
+ acceptFocusOnSelection = FocusInEditorExtensionsManager.getInstance().accept(activeEditor, selection_p);
+ }
+ else
+ {// Because selection comes from Contextual Explorer View, So all selection objects are IStructuredSelection.
+ // This case is handled just to be safe.
+ acceptFocusOnSelection = false;
+ }
+ }
+// else
+// {
+// acceptFocusOnSelection = false;
+// }
+ }
+ fireSourceChanged(ISources.WORKBENCH, MY_STATE, acceptFocusOnSelection ? ENABLED : DISENABLED);
+ }
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/IFocusInEditor.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/IFocusInEditor.java
new file mode 100644
index 0000000..6fc8352
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/focus/IFocusInEditor.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view.focus;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ */
+public interface IFocusInEditor {
+
+ /**
+ * This method allows a contributor to accept or not to handle focus.
+ * @param activeEditor_p the active {@link IEditorPart}
+ * @param selection_p the {@link ISelection} to use to change <code>activeEditor_p</code> selection.
+ * @return True if contributor accept to handle focus, false otherwise.
+ */
+ public boolean accept(IEditorPart activeEditor_p, ISelection selection_p);
+
+ /**
+ * Set the focus on the element provided by <code>selection_p</code> in the <code>activeEditor_p</code>
+ * @param activeEditor_p the active {@link IEditorPart}
+ * @param selection_p the {@link ISelection} to use to change selection on <code>activeEditor_p</code>.
+ * @return True if selection is done with success, false otherwise.
+ */
+ public boolean focusInEditor(IEditorPart activeEditor_p, ISelection selection_p);
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/handlers/SelectInCurrentEditorHandler.java b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/handlers/SelectInCurrentEditorHandler.java
new file mode 100644
index 0000000..2fe9929
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.contextual/src/org/eclipse/amalgam/explorer/contextual/view/handlers/SelectInCurrentEditorHandler.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.contextual.view.handlers;
+
+import org.eclipse.amalgam.explorer.contextual.core.ui.view.ExplorerContextualView;
+import org.eclipse.amalgam.explorer.contextual.view.focus.FocusInEditorExtensionsManager;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ */
+public class SelectInCurrentEditorHandler extends AbstractHandler{
+
+ @Override
+ public Object execute(ExecutionEvent event_p) throws ExecutionException {
+ Object applicationContext = event_p.getApplicationContext();
+ if (applicationContext instanceof IEvaluationContext)
+ {
+ IEvaluationContext evaluationContext = (IEvaluationContext) applicationContext;
+ Object variable = evaluationContext.getVariable("activePart");
+ if (variable instanceof IViewPart && variable instanceof ExplorerContextualView)
+ {
+ ExplorerContextualView explorerContextualView = (ExplorerContextualView) variable;
+ ISelection selection = explorerContextualView.getSite().getSelectionProvider().getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart activeEditor = (IEditorPart) page.getActiveEditor();
+
+ if (activeEditor != null)
+ {
+// boolean wasViewListeningToSelectionChanges = false;
+// if (ExplorerContextualView.isListeningToPageSelectionEvents())
+// {
+// explorerContextualView.deactivateListeningToPageSelectionEvents();
+// wasViewListeningToSelectionChanges = true;
+// }
+
+ boolean done = FocusInEditorExtensionsManager.getInstance().doFocus(activeEditor, selection);
+ if (done)
+ {// This is not needed because it change selection and focus on new element in the Contextual Explorer.
+// page.activate(activeEditor);
+// activeEditor.setFocus();
+ }
+ else
+ {
+ // Display a pop-up dialog informing user that focus can't be done in the current editor
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageDialog.openInformation(shell, "Contextual Explorer", "Can't focus on the selected element in the open editor");
+ }
+
+// if (wasViewListeningToSelectionChanges)
+// {
+// explorerContextualView.activateListeningToPageSelectionEvents();
+// }
+ }
+ else
+ {
+ // Display a pop-up dialog that there is no open editor
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageDialog.openInformation(shell, "Contextual Explorer", "There is no open editor");
+ }
+ }
+ }
+ }
+ return null;
+ }
+}