diff options
524 files changed, 27247 insertions, 17596 deletions
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.sdk.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.sdk.feature/feature.xml index 59fd99edd00..60ec26a3b6b 100644 --- a/features/papyrus-main-features/org.eclipse.papyrus.sdk.feature/feature.xml +++ b/features/papyrus-main-features/org.eclipse.papyrus.sdk.feature/feature.xml @@ -117,9 +117,13 @@ http://www.eclipse.org/legal/epl-v10.html <includes id="org.eclipse.papyrus.uml.xtext.integration.feature" version="0.0.0"/> - - <includes - id="org.eclipse.papyrus.infra.internationalization.feature" + + <includes + id="org.eclipse.papyrus.infra.internationalization.feature" + version="0.0.0"/> + + <includes + id="org.eclipse.papyrus.uml.internationalization.feature" version="0.0.0"/> <includes diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/.project b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/.project new file mode 100644 index 00000000000..c3ec75f9c45 --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/.project @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.internationalization.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.oomph.version.VersionBuilder</name> + <arguments> + <dictionary> + <key>check.maven.pom</key> + <value>true</value> + </dictionary> + <dictionary> + <key>ignore.lower.bound.dependency.ranges</key> + <value>true</value> + </dictionary> + <dictionary> + <key>release.path</key> + <value>/org.eclipse.papyrus.releng.main.release/release.xml</value> + </dictionary> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.FeatureNature</nature> + <nature>org.eclipse.oomph.version.VersionNature</nature> + </natures> +</projectDescription> diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/build.properties b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/build.properties new file mode 100644 index 00000000000..b9ce3341aac --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/build.properties @@ -0,0 +1,7 @@ +bin.includes = feature.xml,\ + build.properties,\ + epl-v10.html,\ + license.html,\ + feature.properties +src.includes = epl-v10.html,\ + license.html diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/epl-v10.html b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/epl-v10.html new file mode 100644 index 00000000000..cb1073a4bad --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/epl-v10.html @@ -0,0 +1,304 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<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=ISO-8859-1"> +<link rel=File-List +href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> +<title>Eclipse Public License - Version 1.0</title> +<style> +<!-- + /* Font Definitions */ +@font-face + { + panose-1:2 11 6 4 3 5 4 4 2 4; + mso-font-charset:0; + 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; + } +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; + } +p.BalloonText, li.BalloonText, div.BalloonText + {mso-style-name:"Balloon Text"; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:8.0pt; + + } +@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></p> + +</div> + +</body> + +</html>
\ No newline at end of file diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.properties b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.properties new file mode 100644 index 00000000000..11ac9ede269 --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.properties @@ -0,0 +1,132 @@ +# NLS_MESSAGEFORMAT_VAR + +# "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\ +April 9, 2014\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\ +\t- Content may be structured and packaged into modules to facilitate delivering,\n\ +\t extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ +\t plug-in fragments ("Fragments"), and features ("Features").\n\ +\t- Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ +\t in a directory named "plugins".\n\ +\t- A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ +\t Each Feature may be packaged as a sub-directory in a directory named "features".\n\ +\t Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ +\t numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ +\t- Features may also include other Features ("Included Features"). Within a Feature, files\n\ +\t 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\ +\t- The top-level (root) directory\n\ +\t- Plug-in and Fragment directories\n\ +\t- Inside Plug-ins and Fragments packaged as JARs\n\ +\t- Sub-directories of the directory named "src" of certain Plug-ins\n\ +\t- 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\ +\t- Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\ +\t- Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ +\t- Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ +\t- Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ +\t- 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\ +\t1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ +\t the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ +\t extending or updating the functionality of an Eclipse-based product.\n\ +\t2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ +\t Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ +\t3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ +\t govern the use of the Installable Software ("Installable Software Agreement") and such\n\ +\t Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ +\t with the Specification. Such Installable Software Agreement must inform the user of the\n\ +\t terms and conditions that govern the Installable Software and must solicit acceptance by\n\ +\t the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ +\t indication of agreement by the user, the provisioning Technology will complete installation\n\ +\t 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/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.xml new file mode 100644 index 00000000000..b831504d0f7 --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/feature.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="org.eclipse.papyrus.uml.internationalization.feature" + label="Papyrus UML Internationalization" + version="1.0.0.qualifier" + provider-name="Eclipse Modeling Project"> + + <copyright url="http://www.eclipse.org/legal/epl-v10.html"> + Copyright (c) 2016 CEA LIST +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License +v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + </copyright> + + <license url="%licenseURL"> + %license + </license> + + <plugin + id="org.eclipse.papyrus.uml.internationalization" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.papyrus.uml.internationalization.edit" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.papyrus.uml.internationalization.utils" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + +</feature> diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/license.html b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/license.html new file mode 100644 index 00000000000..c3d34c3c21e --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.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 9, 2014</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>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li> + <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>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/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/pom.xml b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/pom.xml new file mode 100644 index 00000000000..da1dddbc366 --- /dev/null +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.internationalization.feature/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.eclipse.papyrus</groupId> + <artifactId>org.eclipse.papyrus.features</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.internationalization.feature</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-feature</packaging> +</project>
\ No newline at end of file diff --git a/features/papyrus-main-features/pom.xml b/features/papyrus-main-features/pom.xml index bd910ac2859..03dc9ca140f 100644 --- a/features/papyrus-main-features/pom.xml +++ b/features/papyrus-main-features/pom.xml @@ -37,6 +37,7 @@ <module>org.eclipse.papyrus.uml.diagram.feature</module> <module>org.eclipse.papyrus.uml.feature</module> <module>org.eclipse.papyrus.uml.modelexplorer.feature</module> + <module>org.eclipse.papyrus.uml.internationalization.feature</module> <module>org.eclipse.papyrus.uml.nattable.feature</module> <module>org.eclipse.papyrus.uml.properties.feature</module> <module>org.eclipse.papyrus.uml.search.feature</module> diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpartview/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.gmf.editpartview/META-INF/MANIFEST.MF index 8330ade9420..b4c413d72d0 100644 --- a/plugins/developer/org.eclipse.papyrus.gmf.editpartview/META-INF/MANIFEST.MF +++ b/plugins/developer/org.eclipse.papyrus.gmf.editpartview/META-INF/MANIFEST.MF @@ -4,7 +4,8 @@ Export-Package: org.eclipse.papyrus.gmf.editpartview, Require-Bundle: org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.8.0,2.0.0)", org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)", - org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)" + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpartview/src/org/eclipse/papyrus/gmf/editpartview/view/EditPartLabelProvider.java b/plugins/developer/org.eclipse.papyrus.gmf.editpartview/src/org/eclipse/papyrus/gmf/editpartview/view/EditPartLabelProvider.java index ff1506d108e..a87338e7953 100644 --- a/plugins/developer/org.eclipse.papyrus.gmf.editpartview/src/org/eclipse/papyrus/gmf/editpartview/view/EditPartLabelProvider.java +++ b/plugins/developer/org.eclipse.papyrus.gmf.editpartview/src/org/eclipse/papyrus/gmf/editpartview/view/EditPartLabelProvider.java @@ -1,94 +1,96 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
- * Based on edit policy view from patrick.tessier@cea.fr
- */
-package org.eclipse.papyrus.gmf.editpartview.view;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.NamedElement;
-
-
-/**
- * This is the label provider to display edit parts
- *
- */
-public class EditPartLabelProvider implements ITableLabelProvider, ITableColorProvider {
-
- protected Color papyrusColor = new Color(Display.getDefault(), 0, 127, 14);
-
- protected Color customizableDropEditPolicyColor = new Color(Display.getDefault(), 0, 38, 255);
-
- @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 getColumnText(Object element, int columnIndex) {
- if (element instanceof GraphicalEditPart) {
- GraphicalEditPart editPart = (GraphicalEditPart) element;
- IFigure figure = editPart.getContentPane();
- Object model = editPart.getAdapter(EObject.class);
- switch (columnIndex) {
- case 0:
- return editPart.getClass().getSimpleName();
- case 1:
- if (model instanceof NamedElement) {
- return ((NamedElement) model).getName();
- }
- return "not a named element";
- case 2:
- return figure.getClass().getSimpleName();
- case 3:
- return figure.getBounds().toString();
- }
- }
- return "cannot display it: " + element;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- @Override
- public Color getForeground(Object element, int columnIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Color getBackground(Object element, int columnIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-};
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation + * Based on edit policy view from patrick.tessier@cea.fr + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + */ +package org.eclipse.papyrus.gmf.editpartview.view; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ITableColorProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.NamedElement; + + +/** + * This is the label provider to display edit parts + * + */ +public class EditPartLabelProvider implements ITableLabelProvider, ITableColorProvider { + + protected Color papyrusColor = new Color(Display.getDefault(), 0, 127, 14); + + protected Color customizableDropEditPolicyColor = new Color(Display.getDefault(), 0, 38, 255); + + @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 getColumnText(Object element, int columnIndex) { + if (element instanceof GraphicalEditPart) { + GraphicalEditPart editPart = (GraphicalEditPart) element; + IFigure figure = editPart.getContentPane(); + Object model = editPart.getAdapter(EObject.class); + switch (columnIndex) { + case 0: + return editPart.getClass().getSimpleName(); + case 1: + if (model instanceof NamedElement) { + return UMLLabelInternationalization.getInstance().getLabel((NamedElement) model); + } + return "not a named element"; + case 2: + return figure.getClass().getSimpleName(); + case 3: + return figure.getBounds().toString(); + } + } + return "cannot display it: " + element; + } + + @Override + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + @Override + public Color getForeground(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Color getBackground(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } +}; diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTreeTable.xwt b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTreeTable.xwt index 42cdd7da6bb..a2e58450cb6 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTreeTable.xwt +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTreeTable.xwt @@ -8,10 +8,17 @@ </Composite.layout> <Composite> <Composite.layout> - <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> + <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="nattable:nattableconfiguration:TableNamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" + property="nattable:nattableconfiguration:TableNamedElement:label"></ppe:StringEditor> + </Composite> + <Composite> + <Composite.layout> + <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> + </Composite.layout> <ppe:ReferenceLabel input="{Binding}" property="nattable:Table:prototype" readOnly="true" customLabel="View Type"></ppe:ReferenceLabel> <ppe:ReferenceDialog input="{Binding}" property="nattable:Table:owner" diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF index 033455f8e12..cfcdd23cfde 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0 org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.sysml.diagram.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.sysml.service.types;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/BlockDefinitionDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/BlockDefinitionDiagramForMultiEditor.java index 103bd30d935..a5c21be0d38 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/BlockDefinitionDiagramForMultiEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/BlockDefinitionDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.blockdefinition; @@ -23,6 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.sysml.diagram.blockdefinition.part.BlockDefinitionDiagramEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -70,7 +72,7 @@ public class BlockDefinitionDiagramForMultiEditor extends BlockDefinitionDiagram @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF index 1783a3e4258..20ca98c4fc9 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF @@ -33,7 +33,9 @@ Require-Bundle: org.eclipse.emf;bundle-version="[2.6.0,3.0.0)", org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.diagram.composite;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java index 4fef645ef06..f332eb80329 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.common.parser; @@ -32,6 +32,7 @@ import org.eclipse.papyrus.sysml.portandflows.FlowPort; import org.eclipse.papyrus.sysml.portandflows.FlowSpecification; import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.InstanceValue; @@ -129,7 +130,7 @@ public class FlowPortLabelParser extends PropertyLabelParser { // manage name if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (property.isSetName())) { - String name = property.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(property); result = String.format(NAME_FORMAT, result, name); } @@ -138,7 +139,7 @@ public class FlowPortLabelParser extends PropertyLabelParser { String type = "<Undefined>"; if (property.getType() != null) { - type = property.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. @@ -164,7 +165,7 @@ public class FlowPortLabelParser extends PropertyLabelParser { if ((maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((property.getDefaultValue() != null))) { ValueSpecification valueSpecification = property.getDefaultValue(); if (valueSpecification instanceof InstanceValue) { - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification)); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); } } @@ -186,7 +187,7 @@ public class FlowPortLabelParser extends PropertyLabelParser { EList<Property> redefinedProperties = property.getRedefinedProperties(); if (redefinedProperties != null && !redefinedProperties.isEmpty()) { for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName()); + sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); } } if (sb.length() != 0) { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java index 548984a5c1f..c7984cb850b 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.common.parser; @@ -26,6 +26,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.sysml.requirements.Requirement; import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.util.UMLUtil; @@ -63,7 +64,7 @@ public class RequirementLabelParser extends NamedElementLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME)) { - String name = clazz.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(clazz); result = String.format(NAME_FORMAT, name); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java index 041a725ad39..10242f87699 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.common.parser; @@ -30,6 +30,7 @@ import org.eclipse.papyrus.sysml.blocks.Dimension; import org.eclipse.papyrus.sysml.blocks.Unit; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.util.UMLUtil; @@ -68,7 +69,7 @@ public class UnitLabelParser extends NamedElementLabelParser { // manage name if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (iSpec.isSetName())) { - String name = iSpec.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(iSpec); result = String.format(NAME_FORMAT, name); } @@ -78,7 +79,7 @@ public class UnitLabelParser extends NamedElementLabelParser { if ((unit != null) && (unit.getDimension() != null)) { Dimension dim = unit.getDimension(); if ((dim.getBase_InstanceSpecification() != null) && (dim.getBase_InstanceSpecification().isSetName())) { - dimensionName = dim.getBase_InstanceSpecification().getName(); + dimensionName = UMLLabelInternationalization.getInstance().getLabel(dim.getBase_InstanceSpecification()); } } result = String.format(DIMENSION_FORMAT, result, dimensionName); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java index ac2699f927b..9cb1c33b8fd 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -24,6 +24,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Association; @@ -87,7 +88,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && property.isSetName()) { - String name = property.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(property); // If property is owned by Association (non navigable) only show the name when explicitly asked. @@ -101,7 +102,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (property.getType() != null) { - type = property.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. @@ -124,7 +125,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { // manage default value if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification)); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); } // manage modifier @@ -145,7 +146,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { EList<Property> redefinedProperties = property.getRedefinedProperties(); if (redefinedProperties != null && !redefinedProperties.isEmpty()) { for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName()); + sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); } } if (sb.length() != 0) { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java index d8b67756741..dba310651f9 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Connector; import org.eclipse.uml2.uml.UMLPackage; @@ -62,7 +63,7 @@ public class ConnectorLabelParser extends NamedElementLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && (connector.isSetName())) { - String name = connector.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(connector); result = String.format(NAME_FORMAT, name); } @@ -70,7 +71,7 @@ public class ConnectorLabelParser extends NamedElementLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (connector.getType() != null) { - type = connector.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(connector.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java index b6193fd946d..1dbfdd09dd4 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -28,11 +28,15 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Constraint; @@ -71,7 +75,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // edit name if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { if (semElement.isSetName()) { - editString = semElement.getName(); + editString = UMLLabelInternationalization.getInstance().getLabel(semElement); } // (try to) edit constraint specification @@ -107,7 +111,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // manage name if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (semElement.isSetName())) { - String name = semElement.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(semElement); result = String.format(NAME_FORMAT, name); } @@ -115,7 +119,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { String spec = "<Undefined>"; if (semElement.getSpecification() != null) { - spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification()); + spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification(), true); if (spec == null || "".equals(spec)) { spec = "<Undefined>"; } @@ -144,8 +148,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // prepare set name request if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { - updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); - updateRequest.setLabel("Update Constraint Label"); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(constraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(constraint)){ + final ModelSet modelSet = (ModelSet)constraint.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), constraint, newString, null)); + }else{ + updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + updateRequest.setLabel("Update Constraint Label"); + } // prepare set specification request } else if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java index f35c93eef23..dd5db038963 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -31,11 +31,15 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.UMLPackage; @@ -55,7 +59,7 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { if ((eObject != null) && (eObject instanceof NamedElement)) { NamedElement semElement = (NamedElement) eObject; if (semElement.isSetName()) { - editString = semElement.getName(); + editString = UMLLabelInternationalization.getInstance().getLabel(semElement); } } return editString; @@ -83,7 +87,12 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { } try { - command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(objectToEdit) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)objectToEdit)){ + final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); + }else{ + command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + } } catch (ServiceException e) { Activator.log.error(e); } @@ -100,7 +109,7 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { EObject eObject = EMFHelper.getEObject(element); if (eObject instanceof NamedElement) { - return ((NamedElement) eObject).getName(); + return UMLLabelInternationalization.getInstance().getLabel((NamedElement) eObject); } return result; diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java index 1c8aa32e973..81ef14ccf77 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -30,6 +30,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.tools.util.StringHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.uml.diagram.common.utils.ParameterLabelUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Operation; import org.eclipse.uml2.uml.Parameter; @@ -101,7 +102,7 @@ public class OperationLabelParser extends NamedElementLabelParser { // manage name and parameters if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (operation.isSetName())) { - String name = operation.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(operation); StringBuffer params = new StringBuffer(); for (Parameter parameter : operation.getOwnedParameters()) { @@ -118,7 +119,7 @@ public class OperationLabelParser extends NamedElementLabelParser { if ((maskValues.contains(ICustomAppearance.DISP_TYPE))) { String type = "<Undefined>"; if (operation.getType() != null) { - type = operation.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(operation.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java index 0fd37969d94..89ea3a8e1d7 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -28,6 +28,7 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Property; @@ -113,7 +114,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && (property.isSetName())) { - String name = property.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(property); result = String.format(NAME_FORMAT, result, name); } @@ -121,7 +122,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (property.getType() != null) { - type = property.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. @@ -143,7 +144,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { // manage default value if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification)); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); } // manage modifier @@ -164,7 +165,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { EList<Property> redefinedProperties = property.getRedefinedProperties(); if (redefinedProperties != null && !redefinedProperties.isEmpty()) { for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName()); + sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); } } if (sb.length() != 0) { diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java index 7c7fe85686c..a5fbfaef55c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Reception; import org.eclipse.uml2.uml.UMLPackage; @@ -65,7 +66,7 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && reception.isSetName()) { - String name = reception.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(reception); result = String.format(NAME_FORMAT, result, name); } @@ -73,7 +74,7 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa if (maskValues.contains(ILabelPreferenceConstants.DISP_SIGNAL)) { String type = "<Undefined>"; if (reception.getSignal() != null) { - type = reception.getSignal().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(reception.getSignal()); } result = String.format(TYPE_FORMAT, result, type); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java index ca346d9aecf..edb3268fffb 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java @@ -1,135 +1,136 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.utils;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil;
-import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-public class ParameterLabelUtil {
-
- /** The String format for displaying a {@link Parameter} with direction */
- protected static final String DIRECTION_FORMAT = "%s %s";
-
- /** The String format for displaying a {@link Parameter} label with its name */
- protected static final String NAME_FORMAT = "%s%s";
-
- /** The String format for displaying a {@link Parameter} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /** The String format for displaying a {@link Parameter} label with its multiplicity */
- protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a {@link Parameter} label with its default value */
- protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
-
- /** The String format for displaying a {@link Parameter} label with its modifiers */
- protected static final String MODIFIER_FORMAT = "%s{%s}";
-
- public static String getPrintString(Parameter parameter, Collection<String> displayValue) {
- if (displayValue.isEmpty()) {
- return IMaskManagedSemanticParser.MaskedLabel;
- }
-
- String result = "";
-
- if (parameter != null) {
-
- // manage direction
- if (displayValue.contains(ICustomAppearance.DISP_DIRECTION) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) {
- String direction;
- switch (parameter.getDirection().getValue()) {
- case ParameterDirectionKind.IN:
- direction = "in";
- break;
- case ParameterDirectionKind.OUT:
- direction = "out";
- break;
- case ParameterDirectionKind.INOUT:
- direction = "inout";
- break;
- case ParameterDirectionKind.RETURN:
- direction = "return";
- break;
- default:
- direction = "in";
- break;
- }
- result = String.format(DIRECTION_FORMAT, direction, result);
- }
-
- // manage name
- if ((displayValue.contains(ICustomAppearance.DISP_NAME) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) && (parameter.isSetName())) {
- String name = parameter.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage type
- if (displayValue.contains(ICustomAppearance.DISP_TYPE) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
- String type = "<Undefined>";
- if (parameter.getType() != null) {
- type = parameter.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if (displayValue.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(parameter, displayValue);
- if (multiplicity != null && !multiplicity.isEmpty()) {
- result += " " + multiplicity;
- }
-
- // manage default value
- if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || displayValue.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = parameter.getDefaultValue();
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
-
- // manage modifier
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MODIFIERS) || displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
- StringBuffer sb = new StringBuffer();
- if (parameter.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if (parameter.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if (parameter.isStream()) {
- sb.append(sb.length() == 0 ? "stream" : ", stream");
- }
- if (parameter.isException()) {
- sb.append(sb.length() == 0 ? "exception" : ", exception");
- }
- if (sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
-
- }
- return result;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.utils; + +import java.util.Collection; + +import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; +import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; +import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.ValueSpecification; + + +public class ParameterLabelUtil { + + /** The String format for displaying a {@link Parameter} with direction */ + protected static final String DIRECTION_FORMAT = "%s %s"; + + /** The String format for displaying a {@link Parameter} label with its name */ + protected static final String NAME_FORMAT = "%s%s"; + + /** The String format for displaying a {@link Parameter} label with its type */ + protected static final String TYPE_FORMAT = "%s: %s"; + + /** The String format for displaying a {@link Parameter} label with its multiplicity */ + protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]"; + + /** The String format for displaying a {@link Parameter} label with its default value */ + protected static final String DEFAULT_VALUE_FORMAT = "%s= %s"; + + /** The String format for displaying a {@link Parameter} label with its modifiers */ + protected static final String MODIFIER_FORMAT = "%s{%s}"; + + public static String getPrintString(Parameter parameter, Collection<String> displayValue) { + if (displayValue.isEmpty()) { + return IMaskManagedSemanticParser.MaskedLabel; + } + + String result = ""; + + if (parameter != null) { + + // manage direction + if (displayValue.contains(ICustomAppearance.DISP_DIRECTION) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) { + String direction; + switch (parameter.getDirection().getValue()) { + case ParameterDirectionKind.IN: + direction = "in"; + break; + case ParameterDirectionKind.OUT: + direction = "out"; + break; + case ParameterDirectionKind.INOUT: + direction = "inout"; + break; + case ParameterDirectionKind.RETURN: + direction = "return"; + break; + default: + direction = "in"; + break; + } + result = String.format(DIRECTION_FORMAT, direction, result); + } + + // manage name + if ((displayValue.contains(ICustomAppearance.DISP_NAME) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) && (parameter.isSetName())) { + String name = UMLLabelInternationalization.getInstance().getLabel(parameter); + result = String.format(NAME_FORMAT, result, name); + } + + // manage type + if (displayValue.contains(ICustomAppearance.DISP_TYPE) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { + String type = "<Undefined>"; + if (parameter.getType() != null) { + type = UMLLabelInternationalization.getInstance().getLabel(parameter.getType()); + } + + // If type is undefined only show "<Undefined>" when explicitly asked. + if (displayValue.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) { + result = String.format(TYPE_FORMAT, result, type); + } + } + + // manage multiplicity + String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(parameter, displayValue); + if (multiplicity != null && !multiplicity.isEmpty()) { + result += " " + multiplicity; + } + + // manage default value + if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || displayValue.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) { + ValueSpecification valueSpecification = parameter.getDefaultValue(); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); + } + + // manage modifier + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MODIFIERS) || displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { + StringBuffer sb = new StringBuffer(); + if (parameter.isOrdered()) { + sb.append(sb.length() == 0 ? "ordered" : ", ordered"); + } + if (parameter.isUnique()) { + sb.append(sb.length() == 0 ? "unique" : ", unique"); + } + if (parameter.isStream()) { + sb.append(sb.length() == 0 ? "stream" : ", stream"); + } + if (parameter.isException()) { + sb.append(sb.length() == 0 ? "exception" : ", exception"); + } + if (sb.length() != 0) { + result = String.format(MODIFIER_FORMAT, result, sb.toString()); + } + } + + } + return result; + } + +} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java index 957f7ddf5d5..4437e9f5e9c 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.common; @@ -33,10 +33,10 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.papyrus.infra.core.log.LogHelper; import org.eclipse.papyrus.sysml.portandflows.FlowDirection; import org.eclipse.papyrus.sysml.portandflows.FlowPort; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; import org.osgi.framework.BundleContext; //import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory; //import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory; @@ -285,7 +285,7 @@ public class Activator extends AbstractUIPlugin { // factories.add(new PortandflowsItemProviderAdapterFactory()); // factories.add(new RequirementsItemProviderAdapterFactory()); // Add UML adapter - factories.add(new UMLItemProviderAdapterFactory()); + factories.add(new InternationalizationUMLItemProviderAdapterFactory()); // Other adapters factories.add(new EcoreItemProviderAdapterFactory()); diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF index 8f438356c57..0892dd3cc43 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock, Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.sysml.diagram.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.sysml.service.types;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramForMultiEditor.java index 8155867ca48..b50f917caf6 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramForMultiEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/InternalBlockDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.internalblock; @@ -23,6 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.sysml.diagram.internalblock.part.InternalBlockDiagramEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -70,7 +72,7 @@ public class InternalBlockDiagramForMultiEditor extends InternalBlockDiagramEdit @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF index 61654370816..26bfc574664 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1. org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java index ee096dc9e71..725e124586f 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * R�gis CHEVREL: chevrel.regis <at> gmail.com * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.parametric; @@ -23,6 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.sysml.diagram.parametric.part.ParametricDiagramEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -70,7 +72,7 @@ public class ParametricDiagramForMultiEditor extends ParametricDiagramEditor { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java index 5709767d37d..f53b3b6be81 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java @@ -7,13 +7,15 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Régis CHEVREL: chevrel.regis <at> gmail.com + * R�gis CHEVREL: chevrel.regis <at> gmail.com * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockLabelNameEditPart; public class CustomBlockLabelNameEditPart extends BlockLabelNameEditPart { @@ -27,7 +29,7 @@ public class CustomBlockLabelNameEditPart extends BlockLabelNameEditPart { */ @Override protected String getLabelText() { - String diagramName = getDiagramView().getName(); + String diagramName = LabelInternationalization.getInstance().getDiagramLabel(getDiagramView()); return super.getLabelText() + " [" + diagramName + "]"; } } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/META-INF/MANIFEST.MF index d1191935063..ae52be451e6 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/META-INF/MANIFEST.MF @@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4. org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.sysml.diagram.common;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src-gen/org/eclipse/papyrus/sysml/diagram/requirement/RequirementDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src-gen/org/eclipse/papyrus/sysml/diagram/requirement/RequirementDiagramForMultiEditor.java index 0fe44cb82cc..ad4bba4a0bb 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src-gen/org/eclipse/papyrus/sysml/diagram/requirement/RequirementDiagramForMultiEditor.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src-gen/org/eclipse/papyrus/sysml/diagram/requirement/RequirementDiagramForMultiEditor.java @@ -11,6 +11,7 @@ * CEA LIST- Initial API and implementation * Nizar GUEDIDI (CEA LIST)- modification * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * ****************************************************************************/ package org.eclipse.papyrus.sysml.diagram.requirement; @@ -24,6 +25,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.sysml.diagram.requirement.part.RequirementDiagramEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -71,7 +73,7 @@ public class RequirementDiagramForMultiEditor extends RequirementDiagramEditor { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src/org/eclipse/papyrus/sysml/diagram/requirement/edit/part/CustomRequirementEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src/org/eclipse/papyrus/sysml/diagram/requirement/edit/part/CustomRequirementEditPart.java index 0ee257a59dc..fc917caf9bb 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src/org/eclipse/papyrus/sysml/diagram/requirement/edit/part/CustomRequirementEditPart.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.requirement/src/org/eclipse/papyrus/sysml/diagram/requirement/edit/part/CustomRequirementEditPart.java @@ -1,86 +1,88 @@ -/*****************************************************************************
- * Copyright (c) 2012 ATOS.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Olivier Mélois (ATOS) - Initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.requirement.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.requirement.figure.CustomRequirementFigure;
-import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
-import org.eclipse.papyrus.uml.diagram.common.commands.ShowHideCompartmentRequest;
-import org.eclipse.uml2.uml.NamedElement;
-
-public class CustomRequirementEditPart extends ClassEditPart {
-
- //protected static final String ICONS_PATH = "/org.eclipse.papyrus.sysml/icons/requirements/Requirement.gif"; //$NON-NLS-1$
-
- public CustomRequirementEditPart(View view) {
- super(view);
- }
-
-
- @Override
- protected IFigure createNodeShape() {
- // Showing the information compartment.
- View notationView = getNotationView();
- Request request = new ShowHideCompartmentRequest(ShowHideCompartmentRequest.SHOW, notationView);
- request.setType(ShowHideCompartmentRequest.SHOW_HIDE_COMPARTMENT);
- Command showCompartmentCommand = this.getCommand(request);
- getEditDomain().getCommandStack().execute(showCompartmentCommand);
-
- primaryShape = new CustomRequirementFigure();
- // ((CustomRequirementFigure)primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH));
- return primaryShape;
- }
-
- public void refreshTitle() {
- NamedElement clazz = (NamedElement) ((View) this.getModel()).getElement();
- String requirementName = clazz.getName();
- ((CustomRequirementFigure) this.getFigure()).setName(requirementName);
- }
-
- @Override
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CustomRequirementInformationCompartmentEditPart) {
- IFigure pane = ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure();
- setupContentPane(pane); // FIXME each compartment should handle his content pane in his own way
- pane.add(((CustomRequirementInformationCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return super.addFixedChild(childEditPart);
- }
-
- @Override
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CustomRequirementInformationCompartmentEditPart) {
- IFigure pane = ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure();
- setupContentPane(pane); // FIXME each compartment should handle his content pane in his own way
- pane.remove(((CustomRequirementInformationCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return super.removeFixedChild(childEditPart);
- }
-
- @Override
- public IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof CustomRequirementInformationCompartmentEditPart) {
- return ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure();
- }
- return super.getContentPaneFor(editPart);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2012 ATOS. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Olivier Mélois (ATOS) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + ******************************************************************************/ +package org.eclipse.papyrus.sysml.diagram.requirement.edit.part; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.sysml.diagram.requirement.figure.CustomRequirementFigure; +import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; +import org.eclipse.papyrus.uml.diagram.common.commands.ShowHideCompartmentRequest; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; + +public class CustomRequirementEditPart extends ClassEditPart { + + //protected static final String ICONS_PATH = "/org.eclipse.papyrus.sysml/icons/requirements/Requirement.gif"; //$NON-NLS-1$ + + public CustomRequirementEditPart(View view) { + super(view); + } + + + @Override + protected IFigure createNodeShape() { + // Showing the information compartment. + View notationView = getNotationView(); + Request request = new ShowHideCompartmentRequest(ShowHideCompartmentRequest.SHOW, notationView); + request.setType(ShowHideCompartmentRequest.SHOW_HIDE_COMPARTMENT); + Command showCompartmentCommand = this.getCommand(request); + getEditDomain().getCommandStack().execute(showCompartmentCommand); + + primaryShape = new CustomRequirementFigure(); + // ((CustomRequirementFigure)primaryShape).setTagIcon(Activator.getPluginIconImage(Activator.ID, ICONS_PATH)); + return primaryShape; + } + + public void refreshTitle() { + NamedElement clazz = (NamedElement) ((View) this.getModel()).getElement(); + String requirementName = UMLLabelInternationalization.getInstance().getLabel(clazz); + ((CustomRequirementFigure) this.getFigure()).setName(requirementName); + } + + @Override + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof CustomRequirementInformationCompartmentEditPart) { + IFigure pane = ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure(); + setupContentPane(pane); // FIXME each compartment should handle his content pane in his own way + pane.add(((CustomRequirementInformationCompartmentEditPart) childEditPart).getFigure()); + return true; + } + return super.addFixedChild(childEditPart); + } + + @Override + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof CustomRequirementInformationCompartmentEditPart) { + IFigure pane = ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure(); + setupContentPane(pane); // FIXME each compartment should handle his content pane in his own way + pane.remove(((CustomRequirementInformationCompartmentEditPart) childEditPart).getFigure()); + return true; + } + return super.removeFixedChild(childEditPart); + } + + @Override + public IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof CustomRequirementInformationCompartmentEditPart) { + return ((CustomRequirementFigure) getPrimaryShape()).getRequirementIdInformationCompartmentFigure(); + } + return super.getContentPaneFor(editPart); + } + +} diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/META-INF/MANIFEST.MF b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/META-INF/MANIFEST.MF index 69bf9a21e0f..e44ff1953c2 100644 --- a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/META-INF/MANIFEST.MF @@ -3,7 +3,8 @@ Require-Bundle: org.eclipse.papyrus.sysml.service.types;bundle-version="[2.0.0,3 org.eclipse.papyrus.sysml.diagram.common;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.modelexplorer;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.newchild;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.sysml.modelexplorer Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/query/GetLabelQuery.java b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/query/GetLabelQuery.java index 20295188017..0eb523de87b 100644 --- a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/query/GetLabelQuery.java +++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src/org/eclipse/papyrus/sysml/modelexplorer/query/GetLabelQuery.java @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 /*****************************************************************************/ package org.eclipse.papyrus.sysml.modelexplorer.query; @@ -18,6 +19,7 @@ import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementEx import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.NamedElement; /** Create a basic label based on element name */ @@ -35,7 +37,7 @@ public class GetLabelQuery implements IJavaQuery2<NamedElement, String> { String label = UNNAMED; if (source.isSetName() && (!"".equals(source.getName().trim()))) { - label = source.getName(); + label = UMLLabelInternationalization.getInstance().getLabel(source); } return label; } diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.edit/META-INF/MANIFEST.MF b/plugins/sysml/org.eclipse.papyrus.sysml.edit/META-INF/MANIFEST.MF index 2e0caf3fe0b..d9510f3a65b 100644 --- a/plugins/sysml/org.eclipse.papyrus.sysml.edit/META-INF/MANIFEST.MF +++ b/plugins/sysml/org.eclipse.papyrus.sysml.edit/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Require-Bundle: org.eclipse.papyrus.sysml;bundle-version="[1.2.0,2.0.0)";visibil org.eclipse.uml2.types;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)";visibility:=reexport, org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)", - org.eclipse.uml2.common.edit;bundle-version="[2.1.0,3.0.0)";visibility:=reexport + org.eclipse.uml2.common.edit;bundle-version="[2.1.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.sysml.activities.provider, org.eclipse.papyrus.sysml.allocations.provider, org.eclipse.papyrus.sysml.blocks.provider, diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.edit/src/org/eclipse/papyrus/sysml/registry/SysmlRegistryAdapterFactoryRegistry.java b/plugins/sysml/org.eclipse.papyrus.sysml.edit/src/org/eclipse/papyrus/sysml/registry/SysmlRegistryAdapterFactoryRegistry.java index a7d7846267b..28655ca7abd 100644 --- a/plugins/sysml/org.eclipse.papyrus.sysml.edit/src/org/eclipse/papyrus/sysml/registry/SysmlRegistryAdapterFactoryRegistry.java +++ b/plugins/sysml/org.eclipse.papyrus.sysml.edit/src/org/eclipse/papyrus/sysml/registry/SysmlRegistryAdapterFactoryRegistry.java @@ -1,432 +1,433 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.registry;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.edit.provider.IComposableAdapterFactory;
-import org.eclipse.papyrus.sysml.edit.provider.IRootAdapterFactory;
-import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.edit.providers.AbstractionItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ActivityEdgeItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ActivityPartitionItemProvider;
-import org.eclipse.uml2.uml.edit.providers.BehaviorItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ClassItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ClassifierItemProvider;
-import org.eclipse.uml2.uml.edit.providers.CommentItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ConnectorEndItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ConnectorItemProvider;
-import org.eclipse.uml2.uml.edit.providers.DataTypeItemProvider;
-import org.eclipse.uml2.uml.edit.providers.DependencyItemProvider;
-import org.eclipse.uml2.uml.edit.providers.InformationFlowItemProvider;
-import org.eclipse.uml2.uml.edit.providers.InstanceSpecificationItemProvider;
-import org.eclipse.uml2.uml.edit.providers.InterfaceItemProvider;
-import org.eclipse.uml2.uml.edit.providers.NamedElementItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ObjectNodeItemProvider;
-import org.eclipse.uml2.uml.edit.providers.OperationItemProvider;
-import org.eclipse.uml2.uml.edit.providers.PackageItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ParameterItemProvider;
-import org.eclipse.uml2.uml.edit.providers.ParameterSetItemProvider;
-import org.eclipse.uml2.uml.edit.providers.PortItemProvider;
-import org.eclipse.uml2.uml.edit.providers.PropertyItemProvider;
-import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
-
-/**
- * Get a registry of all SysML Adapter Factory classified by the UML class their
- * correspond.
- *
- * Example:
- *
- * <Class.class> ->[ModelelementsItemProviderAdapterFactory,
- * BlocksAdapterItemProviderFactory, RequirementsAdapterItemProviderFactory]
- *
- * @generated
- */
-public class SysmlRegistryAdapterFactoryRegistry {
-
- /**
- * Keep track of the item provider of type ModelelementsItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected ModelelementsItemProviderAdapterFactory modelelementsAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type BlocksItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected BlocksItemProviderAdapterFactory blocksAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type PortandflowsItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected PortandflowsItemProviderAdapterFactory portandflowsAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type ConstraintsItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected ConstraintsItemProviderAdapterFactory constraintsAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type ActivitiesItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected ActivitiesItemProviderAdapterFactory activitiesAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type AllocationsItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected AllocationsItemProviderAdapterFactory allocationsAdapterFactoryItemProvider;
-
- /**
- * Keep track of the item provider of type RequirementsItemProviderAdapterFactory
- *
- * @generated
- */
-
- protected RequirementsItemProviderAdapterFactory requirementsAdapterFactoryItemProvider;
-
- /**
- * Registry for all SysML AdapterFactory
- *
- * @generated
- */
- private List<AdapterFactory> adapterFactoryRegistry = new ArrayList<AdapterFactory>(7);
-
- /**
- * Registry of all {@link AdapterFactory} classified by corresponding UML element
- *
- * @generated
- */
- private HashMap<EClass, ArrayList<AdapterFactory>> adapterFactoryRegistryMap = new HashMap<EClass, ArrayList<AdapterFactory>>();
-
- /**
- * Default adapterFactory
- *
- * @generated
- */
- private UMLItemProviderAdapterFactory defaultAdapterFactory = new UMLItemProviderAdapterFactory();
-
- /**
- * Constructor + initialize
- *
- * @generated
- */
- private SysmlRegistryAdapterFactoryRegistry() {
- /**
- * Initialize all AdapterFactories
- */
-
- modelelementsAdapterFactoryItemProvider = new ModelelementsItemProviderAdapterFactory();
- adapterFactoryRegistry.add(modelelementsAdapterFactoryItemProvider);
-
- blocksAdapterFactoryItemProvider = new BlocksItemProviderAdapterFactory();
- adapterFactoryRegistry.add(blocksAdapterFactoryItemProvider);
-
- portandflowsAdapterFactoryItemProvider = new PortandflowsItemProviderAdapterFactory();
- adapterFactoryRegistry.add(portandflowsAdapterFactoryItemProvider);
-
- constraintsAdapterFactoryItemProvider = new ConstraintsItemProviderAdapterFactory();
- adapterFactoryRegistry.add(constraintsAdapterFactoryItemProvider);
-
- activitiesAdapterFactoryItemProvider = new ActivitiesItemProviderAdapterFactory();
- adapterFactoryRegistry.add(activitiesAdapterFactoryItemProvider);
-
- allocationsAdapterFactoryItemProvider = new AllocationsItemProviderAdapterFactory();
- adapterFactoryRegistry.add(allocationsAdapterFactoryItemProvider);
-
- requirementsAdapterFactoryItemProvider = new RequirementsItemProviderAdapterFactory();
- adapterFactoryRegistry.add(requirementsAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the ABSTRACTION elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.ABSTRACTION, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.ABSTRACTION).add(allocationsAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the ACTIVITY_EDGE elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.ACTIVITY_EDGE, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the ACTIVITY_PARTITION elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.ACTIVITY_PARTITION, new ArrayList<AdapterFactory>(Collections.singletonList(allocationsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the BEHAVIOR elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.BEHAVIOR, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.BEHAVIOR).add(activitiesAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the CLASS elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.CLASS, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(modelelementsAdapterFactoryItemProvider);
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(constraintsAdapterFactoryItemProvider);
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(blocksAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the CLASSIFIER elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.CLASSIFIER, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the COMMENT elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.COMMENT, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the CONNECTOR elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.CONNECTOR, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the CONNECTOR_END elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.CONNECTOR_END, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the DATA_TYPE elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.DATA_TYPE, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the DEPENDENCY elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.DEPENDENCY, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the INFORMATION_FLOW elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.INFORMATION_FLOW, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the INSTANCE_SPECIFICATION elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.INSTANCE_SPECIFICATION, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the INTERFACE elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.INTERFACE, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the NAMED_ELEMENT elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.NAMED_ELEMENT, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.NAMED_ELEMENT).add(allocationsAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the OBJECT_NODE elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.OBJECT_NODE, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the OPERATION elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.OPERATION, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.OPERATION).add(activitiesAdapterFactoryItemProvider);
-
- /**
- * AdapterFactories for the PACKAGE elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.PACKAGE, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the PARAMETER elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.PARAMETER, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the PARAMETER_SET elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.PARAMETER_SET, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the PORT elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.PORT, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider)));
-
- /**
- * AdapterFactories for the PROPERTY elements
- */
- adapterFactoryRegistryMap.put(UMLPackage.Literals.PROPERTY, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider)));
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.PROPERTY).add(constraintsAdapterFactoryItemProvider);
-
- adapterFactoryRegistryMap.get(UMLPackage.Literals.PROPERTY).add(blocksAdapterFactoryItemProvider);
-
- }
-
- /**
- * Singleton holder
- *
- * @generated
- */
- private static class SingletonHolder {
-
- protected static SysmlRegistryAdapterFactoryRegistry instance = null;
- static {
- instance = new SysmlRegistryAdapterFactoryRegistry();
- }
- }
-
- /**
- * @generated
- */
- public static SysmlRegistryAdapterFactoryRegistry getSingleton() {
- return SingletonHolder.instance;
- }
-
- /**
- * Get the default AdapterFactory
- *
- * @return List<AdapterFactory> return the default adapter factory (UML)
- * @generated
- */
- public AdapterFactory getDefaultAdapterFactory() {
- return defaultAdapterFactory;
- }
-
- /**
- * Get the list of all AdapterFactory for this type
- *
- * @param Object
- * element
- * @return List<AdapterFactory> List of all the adapter factories which can handle the object element
- * @generated
- */
- public List<AdapterFactory> getAdapterFactoriesForType(Object element) {
- if (element instanceof EObject) {
- EObject eObject = (EObject) element;
- ArrayList<AdapterFactory> result = adapterFactoryRegistryMap.get(eObject.eClass());
- if (result != null) {
- return result;
- } else {
- return Collections.singletonList(getDefaultAdapterFactory());
- }
- } else {
- throw new RuntimeException("org.eclipse.papyrus.sysml.edit.utils.SysmlRegistryAdapterFactoryRegistery : This factory only works with EOBjects");
- }
- }
-
- /**
- * Set the the root AdapterFactory for all registered adapter factory
- *
- * @param AdapterFactory
- * The adapter factory which will be the root
- * @generated
- */
- public void setRootAdapterFactory(IRootAdapterFactory adapter) {
- for (AdapterFactory adap : adapterFactoryRegistry) {
- if (adap instanceof IComposableAdapterFactory) {
- ((IComposableAdapterFactory) adap).setRootAdapterFactory(adapter);
- }
- }
- }
-
- /**
- * Get a map of all UML ItemProvider needed
- *
- * @generated
- */
- public HashMap<EClass, ItemProviderAdapter> getUMLItemProviderClassifedByUMLElement(AdapterFactory rootAdapterFactory) {
- HashMap<EClass, ItemProviderAdapter> result = new HashMap<EClass, ItemProviderAdapter>();
-
- result.put(UMLPackage.Literals.INSTANCE_SPECIFICATION, new InstanceSpecificationItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.CONNECTOR_END, new ConnectorEndItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.OPERATION, new OperationItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.DEPENDENCY, new DependencyItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.OBJECT_NODE, new ObjectNodeItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.DATA_TYPE, new DataTypeItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.PROPERTY, new PropertyItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.BEHAVIOR, new BehaviorItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.COMMENT, new CommentItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.INTERFACE, new InterfaceItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.ABSTRACTION, new AbstractionItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.ACTIVITY_PARTITION, new ActivityPartitionItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.CONNECTOR, new ConnectorItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.PARAMETER_SET, new ParameterSetItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.ACTIVITY_EDGE, new ActivityEdgeItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.CLASSIFIER, new ClassifierItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.NAMED_ELEMENT, new NamedElementItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.PARAMETER, new ParameterItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.PORT, new PortItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.INFORMATION_FLOW, new InformationFlowItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.CLASS, new ClassItemProvider(rootAdapterFactory));
-
- result.put(UMLPackage.Literals.PACKAGE, new PackageItemProvider(rootAdapterFactory));
-
- return result;
- }
-
-} // org.eclipse.papyrus.sysml.registry;
-
+/***************************************************************************** + * Copyright (c) 2011 Atos. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + *****************************************************************************/ +package org.eclipse.papyrus.sysml.registry; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.edit.provider.IComposableAdapterFactory; +import org.eclipse.papyrus.sysml.edit.provider.IRootAdapterFactory; +import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory; +import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.edit.providers.AbstractionItemProvider; +import org.eclipse.uml2.uml.edit.providers.ActivityEdgeItemProvider; +import org.eclipse.uml2.uml.edit.providers.ActivityPartitionItemProvider; +import org.eclipse.uml2.uml.edit.providers.BehaviorItemProvider; +import org.eclipse.uml2.uml.edit.providers.ClassItemProvider; +import org.eclipse.uml2.uml.edit.providers.ClassifierItemProvider; +import org.eclipse.uml2.uml.edit.providers.CommentItemProvider; +import org.eclipse.uml2.uml.edit.providers.ConnectorEndItemProvider; +import org.eclipse.uml2.uml.edit.providers.ConnectorItemProvider; +import org.eclipse.uml2.uml.edit.providers.DataTypeItemProvider; +import org.eclipse.uml2.uml.edit.providers.DependencyItemProvider; +import org.eclipse.uml2.uml.edit.providers.InformationFlowItemProvider; +import org.eclipse.uml2.uml.edit.providers.InstanceSpecificationItemProvider; +import org.eclipse.uml2.uml.edit.providers.InterfaceItemProvider; +import org.eclipse.uml2.uml.edit.providers.NamedElementItemProvider; +import org.eclipse.uml2.uml.edit.providers.ObjectNodeItemProvider; +import org.eclipse.uml2.uml.edit.providers.OperationItemProvider; +import org.eclipse.uml2.uml.edit.providers.PackageItemProvider; +import org.eclipse.uml2.uml.edit.providers.ParameterItemProvider; +import org.eclipse.uml2.uml.edit.providers.ParameterSetItemProvider; +import org.eclipse.uml2.uml.edit.providers.PortItemProvider; +import org.eclipse.uml2.uml.edit.providers.PropertyItemProvider; + +/** + * Get a registry of all SysML Adapter Factory classified by the UML class their + * correspond. + * + * Example: + * + * <Class.class> ->[ModelelementsItemProviderAdapterFactory, + * BlocksAdapterItemProviderFactory, RequirementsAdapterItemProviderFactory] + * + * @generated + */ +public class SysmlRegistryAdapterFactoryRegistry { + + /** + * Keep track of the item provider of type ModelelementsItemProviderAdapterFactory + * + * @generated + */ + + protected ModelelementsItemProviderAdapterFactory modelelementsAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type BlocksItemProviderAdapterFactory + * + * @generated + */ + + protected BlocksItemProviderAdapterFactory blocksAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type PortandflowsItemProviderAdapterFactory + * + * @generated + */ + + protected PortandflowsItemProviderAdapterFactory portandflowsAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type ConstraintsItemProviderAdapterFactory + * + * @generated + */ + + protected ConstraintsItemProviderAdapterFactory constraintsAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type ActivitiesItemProviderAdapterFactory + * + * @generated + */ + + protected ActivitiesItemProviderAdapterFactory activitiesAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type AllocationsItemProviderAdapterFactory + * + * @generated + */ + + protected AllocationsItemProviderAdapterFactory allocationsAdapterFactoryItemProvider; + + /** + * Keep track of the item provider of type RequirementsItemProviderAdapterFactory + * + * @generated + */ + + protected RequirementsItemProviderAdapterFactory requirementsAdapterFactoryItemProvider; + + /** + * Registry for all SysML AdapterFactory + * + * @generated + */ + private List<AdapterFactory> adapterFactoryRegistry = new ArrayList<AdapterFactory>(7); + + /** + * Registry of all {@link AdapterFactory} classified by corresponding UML element + * + * @generated + */ + private HashMap<EClass, ArrayList<AdapterFactory>> adapterFactoryRegistryMap = new HashMap<EClass, ArrayList<AdapterFactory>>(); + + /** + * Default adapterFactory + * + * @generated + */ + private InternationalizationUMLItemProviderAdapterFactory defaultAdapterFactory = new InternationalizationUMLItemProviderAdapterFactory(); + + /** + * Constructor + initialize + * + * @generated + */ + private SysmlRegistryAdapterFactoryRegistry() { + /** + * Initialize all AdapterFactories + */ + + modelelementsAdapterFactoryItemProvider = new ModelelementsItemProviderAdapterFactory(); + adapterFactoryRegistry.add(modelelementsAdapterFactoryItemProvider); + + blocksAdapterFactoryItemProvider = new BlocksItemProviderAdapterFactory(); + adapterFactoryRegistry.add(blocksAdapterFactoryItemProvider); + + portandflowsAdapterFactoryItemProvider = new PortandflowsItemProviderAdapterFactory(); + adapterFactoryRegistry.add(portandflowsAdapterFactoryItemProvider); + + constraintsAdapterFactoryItemProvider = new ConstraintsItemProviderAdapterFactory(); + adapterFactoryRegistry.add(constraintsAdapterFactoryItemProvider); + + activitiesAdapterFactoryItemProvider = new ActivitiesItemProviderAdapterFactory(); + adapterFactoryRegistry.add(activitiesAdapterFactoryItemProvider); + + allocationsAdapterFactoryItemProvider = new AllocationsItemProviderAdapterFactory(); + adapterFactoryRegistry.add(allocationsAdapterFactoryItemProvider); + + requirementsAdapterFactoryItemProvider = new RequirementsItemProviderAdapterFactory(); + adapterFactoryRegistry.add(requirementsAdapterFactoryItemProvider); + + /** + * AdapterFactories for the ABSTRACTION elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.ABSTRACTION, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.ABSTRACTION).add(allocationsAdapterFactoryItemProvider); + + /** + * AdapterFactories for the ACTIVITY_EDGE elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.ACTIVITY_EDGE, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the ACTIVITY_PARTITION elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.ACTIVITY_PARTITION, new ArrayList<AdapterFactory>(Collections.singletonList(allocationsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the BEHAVIOR elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.BEHAVIOR, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.BEHAVIOR).add(activitiesAdapterFactoryItemProvider); + + /** + * AdapterFactories for the CLASS elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.CLASS, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(modelelementsAdapterFactoryItemProvider); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(constraintsAdapterFactoryItemProvider); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.CLASS).add(blocksAdapterFactoryItemProvider); + + /** + * AdapterFactories for the CLASSIFIER elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.CLASSIFIER, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the COMMENT elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.COMMENT, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the CONNECTOR elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.CONNECTOR, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the CONNECTOR_END elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.CONNECTOR_END, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the DATA_TYPE elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.DATA_TYPE, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the DEPENDENCY elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.DEPENDENCY, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the INFORMATION_FLOW elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.INFORMATION_FLOW, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the INSTANCE_SPECIFICATION elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.INSTANCE_SPECIFICATION, new ArrayList<AdapterFactory>(Collections.singletonList(blocksAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the INTERFACE elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.INTERFACE, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the NAMED_ELEMENT elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.NAMED_ELEMENT, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.NAMED_ELEMENT).add(allocationsAdapterFactoryItemProvider); + + /** + * AdapterFactories for the OBJECT_NODE elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.OBJECT_NODE, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the OPERATION elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.OPERATION, new ArrayList<AdapterFactory>(Collections.singletonList(requirementsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.OPERATION).add(activitiesAdapterFactoryItemProvider); + + /** + * AdapterFactories for the PACKAGE elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.PACKAGE, new ArrayList<AdapterFactory>(Collections.singletonList(modelelementsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the PARAMETER elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.PARAMETER, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the PARAMETER_SET elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.PARAMETER_SET, new ArrayList<AdapterFactory>(Collections.singletonList(activitiesAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the PORT elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.PORT, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider))); + + /** + * AdapterFactories for the PROPERTY elements + */ + adapterFactoryRegistryMap.put(UMLPackage.Literals.PROPERTY, new ArrayList<AdapterFactory>(Collections.singletonList(portandflowsAdapterFactoryItemProvider))); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.PROPERTY).add(constraintsAdapterFactoryItemProvider); + + adapterFactoryRegistryMap.get(UMLPackage.Literals.PROPERTY).add(blocksAdapterFactoryItemProvider); + + } + + /** + * Singleton holder + * + * @generated + */ + private static class SingletonHolder { + + protected static SysmlRegistryAdapterFactoryRegistry instance = null; + static { + instance = new SysmlRegistryAdapterFactoryRegistry(); + } + } + + /** + * @generated + */ + public static SysmlRegistryAdapterFactoryRegistry getSingleton() { + return SingletonHolder.instance; + } + + /** + * Get the default AdapterFactory + * + * @return List<AdapterFactory> return the default adapter factory (UML) + * @generated + */ + public AdapterFactory getDefaultAdapterFactory() { + return defaultAdapterFactory; + } + + /** + * Get the list of all AdapterFactory for this type + * + * @param Object + * element + * @return List<AdapterFactory> List of all the adapter factories which can handle the object element + * @generated + */ + public List<AdapterFactory> getAdapterFactoriesForType(Object element) { + if (element instanceof EObject) { + EObject eObject = (EObject) element; + ArrayList<AdapterFactory> result = adapterFactoryRegistryMap.get(eObject.eClass()); + if (result != null) { + return result; + } else { + return Collections.singletonList(getDefaultAdapterFactory()); + } + } else { + throw new RuntimeException("org.eclipse.papyrus.sysml.edit.utils.SysmlRegistryAdapterFactoryRegistery : This factory only works with EOBjects"); + } + } + + /** + * Set the the root AdapterFactory for all registered adapter factory + * + * @param AdapterFactory + * The adapter factory which will be the root + * @generated + */ + public void setRootAdapterFactory(IRootAdapterFactory adapter) { + for (AdapterFactory adap : adapterFactoryRegistry) { + if (adap instanceof IComposableAdapterFactory) { + ((IComposableAdapterFactory) adap).setRootAdapterFactory(adapter); + } + } + } + + /** + * Get a map of all UML ItemProvider needed + * + * @generated + */ + public HashMap<EClass, ItemProviderAdapter> getUMLItemProviderClassifedByUMLElement(AdapterFactory rootAdapterFactory) { + HashMap<EClass, ItemProviderAdapter> result = new HashMap<EClass, ItemProviderAdapter>(); + + result.put(UMLPackage.Literals.INSTANCE_SPECIFICATION, new InstanceSpecificationItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.CONNECTOR_END, new ConnectorEndItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.OPERATION, new OperationItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.DEPENDENCY, new DependencyItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.OBJECT_NODE, new ObjectNodeItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.DATA_TYPE, new DataTypeItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.PROPERTY, new PropertyItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.BEHAVIOR, new BehaviorItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.COMMENT, new CommentItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.INTERFACE, new InterfaceItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.ABSTRACTION, new AbstractionItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.ACTIVITY_PARTITION, new ActivityPartitionItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.CONNECTOR, new ConnectorItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.PARAMETER_SET, new ParameterSetItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.ACTIVITY_EDGE, new ActivityEdgeItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.CLASSIFIER, new ClassifierItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.NAMED_ELEMENT, new NamedElementItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.PARAMETER, new ParameterItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.PORT, new PortItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.INFORMATION_FLOW, new InformationFlowItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.CLASS, new ClassItemProvider(rootAdapterFactory)); + + result.put(UMLPackage.Literals.PACKAGE, new PackageItemProvider(rootAdapterFactory)); + + return result; + } + +} // org.eclipse.papyrus.sysml.registry; + diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/META-INF/MANIFEST.MF b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/META-INF/MANIFEST.MF index 561ef56a893..afeb0065e87 100644 --- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/META-INF/MANIFEST.MF +++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/META-INF/MANIFEST.MF @@ -8,7 +8,8 @@ Export-Package: org.eclipse.papyrus.sysml.service.types, org.eclipse.papyrus.sysml.service.types.menu, org.eclipse.papyrus.sysml.service.types.utils Require-Bundle: org.eclipse.papyrus.sysml;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.uml.service.types.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.uml.service.types.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java index 667ac1570ec..3d91efa7de2 100644 --- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java +++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.sysml.service.types.utils; @@ -28,6 +28,7 @@ import org.eclipse.emf.ecore.EStructuralFeature.Setting; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.sysml.blocks.Block; import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.ConnectableElement; import org.eclipse.uml2.uml.Connector; import org.eclipse.uml2.uml.ConnectorEnd; @@ -257,7 +258,7 @@ public class ConnectorUtils extends org.eclipse.papyrus.uml.service.types.utils. * the property name with name delimiter if it is required */ public static final String getNameWithQuotes(final NamedElement property) { - final String partName = property.getName(); + final String partName = UMLLabelInternationalization.getInstance().getLabel(property); final StringBuffer partNameBuffer = new StringBuffer(); final Pattern pattern = Pattern.compile(ConnectorUtils.HAS_NO_WORD_CHAR_REGEX); final Matcher matcher = pattern.matcher(partName); diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/META-INF/MANIFEST.MF b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/META-INF/MANIFEST.MF index 3189e070045..925fc3d55bf 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/META-INF/MANIFEST.MF +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/META-INF/MANIFEST.MF @@ -2,7 +2,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.properties;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.decoratormodel.ui;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.decoratormodel.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.decoratormodel.internal.properties.constraints;x-internal:=true, org.eclipse.papyrus.uml.decoratormodel.properties, org.eclipse.papyrus.uml.decoratormodel.properties.elements, diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/src/org/eclipse/papyrus/uml/decoratormodel/properties/widgets/ProfileApplicationPropertyEditor.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/src/org/eclipse/papyrus/uml/decoratormodel/properties/widgets/ProfileApplicationPropertyEditor.java index af66845c7dd..46dbfc74282 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/src/org/eclipse/papyrus/uml/decoratormodel/properties/widgets/ProfileApplicationPropertyEditor.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.properties/src/org/eclipse/papyrus/uml/decoratormodel/properties/widgets/ProfileApplicationPropertyEditor.java @@ -8,6 +8,7 @@ * * Contributors: * Christian W. Damus - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -28,6 +29,7 @@ import org.eclipse.papyrus.uml.decoratormodel.internal.properties.messages.Messa import org.eclipse.papyrus.uml.decoratormodel.internal.ui.wizards.ExternalizeProfileApplicationsWizard; import org.eclipse.papyrus.uml.decoratormodel.properties.Activator; import org.eclipse.papyrus.uml.decoratormodel.ui.providers.DeleteEmptyDecoratorModelsPolicy; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.properties.widgets.ProfileApplicationEditor; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; @@ -191,7 +193,7 @@ public class ProfileApplicationPropertyEditor extends org.eclipse.papyrus.uml.pr if ((application != null) && (application.eResource() != getInputPackage().eResource())) { Package rootPackage = (Package) EcoreUtil.getRootContainer(application); - String modelName = rootPackage.getName(); + String modelName = UMLLabelInternationalization.getInstance().getLabel(rootPackage); if (Strings.isNullOrEmpty(modelName)) { modelName = rootPackage.eResource().getURI().trimFileExtension().lastSegment(); } diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/META-INF/MANIFEST.MF b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/META-INF/MANIFEST.MF index 655f2b7c0ed..2be8dab1308 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)", org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)", org.eclipse.papyrus.infra.onefile;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.decoratormodel.internal.ui, org.eclipse.papyrus.uml.decoratormodel.internal.ui.commands;x-friends:="org.eclipse.papyrus.uml.decoratormodel.properties", org.eclipse.papyrus.uml.decoratormodel.internal.ui.expressions;x-internal:=true, diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelDecorator.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelDecorator.java index 3b1c91c837f..8124e53843d 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelDecorator.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelDecorator.java @@ -8,6 +8,7 @@ * * Contributors: * Christian W. Damus - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -31,6 +32,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile; import org.eclipse.papyrus.uml.decoratormodel.helper.DecoratorModelUtils; import org.eclipse.papyrus.uml.decoratormodel.internal.ui.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.ui.ide.IDE; import org.eclipse.uml2.uml.Package; @@ -163,7 +165,7 @@ public class DecoratorModelLabelDecorator extends BaseLabelProvider implements I suffix.append(", "); //$NON-NLS-1$ } - String modelName = next.getName(); + String modelName = UMLLabelInternationalization.getInstance().getLabel(next); if (modelName == null) { modelName = next.eResource().getURI().trimFileExtension().lastSegment(); } diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelProvider.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelProvider.java index 3944aefdee3..d915cd48128 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelProvider.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/DecoratorModelLabelProvider.java @@ -8,6 +8,7 @@ * * Contributors: * Christian W. Damus - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -30,6 +31,7 @@ import org.eclipse.papyrus.uml.decoratormodel.internal.resource.DecoratorModelIn import org.eclipse.papyrus.uml.decoratormodel.internal.resource.DecoratorModelIndexEvent; import org.eclipse.papyrus.uml.decoratormodel.internal.resource.IDecoratorModelIndexListener; import org.eclipse.papyrus.uml.decoratormodel.internal.ui.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.uml2.uml.Package; @@ -98,7 +100,7 @@ public class DecoratorModelLabelProvider extends DelegatingStyledLabelProvider i if (model == null) { modelName = getModelNames().get(resource.getURI()); } else { - modelName = model.getName(); + modelName = UMLLabelInternationalization.getInstance().getLabel(model); } return getStyledText(modelName, resource.getURI()); diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/ProfileResourceLabelProvider.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/ProfileResourceLabelProvider.java index 7edcfcd371c..e78a15b6c07 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/ProfileResourceLabelProvider.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.ui/src/org/eclipse/papyrus/uml/decoratormodel/internal/ui/providers/ProfileResourceLabelProvider.java @@ -8,6 +8,7 @@ * * Contributors: * Christian W. Damus - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -26,6 +27,7 @@ import org.eclipse.papyrus.infra.widgets.providers.DelegatingStyledLabelProvider import org.eclipse.papyrus.uml.decoratormodel.internal.ui.messages.Messages; import org.eclipse.papyrus.uml.extensionpoints.Registry; import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.uml2.uml.Package; @@ -81,12 +83,12 @@ public class ProfileResourceLabelProvider extends DelegatingStyledLabelProvider result = getStyledText(uri); } else if (uri.isPlatformResource()) { result = new StyledString(); - result.append(model.getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(model)); String qualifier = uri.isPlatformResource() ? uri.toPlatformString(true) : uri.toString(); result.append(" - " + qualifier, StyledString.QUALIFIER_STYLER); //$NON-NLS-1$ } else { - result = getStyledText(model.getName(), resource.getURI()); + result = getStyledText(UMLLabelInternationalization.getInstance().getLabel(model), resource.getURI()); } return result; diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/META-INF/MANIFEST.MF b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/META-INF/MANIFEST.MF index 5186903bf8a..c3ec91337e3 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/META-INF/MANIFEST.MF +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.decoratormodel, org.eclipse.papyrus.uml.decoratormodel.helper, org.eclipse.papyrus.uml.decoratormodel.internal.commands;x-internal:=true, diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/providers/ExternalizedProfileApplicationDelegate.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/providers/ExternalizedProfileApplicationDelegate.java index 9f145902ca2..0bc55a13bf9 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/providers/ExternalizedProfileApplicationDelegate.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/providers/ExternalizedProfileApplicationDelegate.java @@ -15,6 +15,7 @@ * Christian W. Damus - 444588, 399859, 451557 * Christian W. Damus - bug 458197 * Christian W. Damus - bug 481302 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -42,6 +43,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.uml.decoratormodel.helper.DecoratorModelUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.helper.IProfileApplicationDelegate; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; @@ -157,7 +159,7 @@ public class ExternalizedProfileApplicationDelegate implements IProfileApplicati Profile profile = ExternalizedProfileApplicationDelegate.this.getAppliedProfile(profileApplication); EPackage definition = profile.getDefinition(); - monitor = SubMonitor.convert(monitor, NLS.bind("Re-applying profile \"{0}\" to package \"{1}\"", profile.getName(), package_.getName()), IProgressMonitor.UNKNOWN); + monitor = SubMonitor.convert(monitor, NLS.bind("Re-applying profile \"{0}\" to package \"{1}\"", UMLLabelInternationalization.getInstance().getLabel(profile), UMLLabelInternationalization.getInstance().getLabel(package_)), IProgressMonitor.UNKNOWN); Collection<EObject> originals = Lists.newArrayList(); StereotypeApplicationCopier copier = new PrivateStereotypeCopier(profile); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF index 6338ab1f07d..89f0de39384 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF @@ -1,60 +1,63 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.activity,
- org.eclipse.papyrus.uml.diagram.activity.commands,
- org.eclipse.papyrus.uml.diagram.activity.draw2d,
- org.eclipse.papyrus.uml.diagram.activity.edit.actions,
- org.eclipse.papyrus.uml.diagram.activity.edit.advices,
- org.eclipse.papyrus.uml.diagram.activity.edit.commands,
- org.eclipse.papyrus.uml.diagram.activity.edit.dialogs,
- org.eclipse.papyrus.uml.diagram.activity.edit.helpers,
- org.eclipse.papyrus.uml.diagram.activity.edit.part,
- org.eclipse.papyrus.uml.diagram.activity.edit.part.ActivityGroup;x-friends:=org.eclipse.papyrus.uml.diagram.activity.tests,
- org.eclipse.papyrus.uml.diagram.activity.edit.parts,
- org.eclipse.papyrus.uml.diagram.activity.edit.policies,
- org.eclipse.papyrus.uml.diagram.activity.expressions,
- org.eclipse.papyrus.uml.diagram.activity.figures,
- org.eclipse.papyrus.uml.diagram.activity.handlers,
- org.eclipse.papyrus.uml.diagram.activity.helper,
- org.eclipse.papyrus.uml.diagram.activity.listeners,
- org.eclipse.papyrus.uml.diagram.activity.locator,
- org.eclipse.papyrus.uml.diagram.activity.migration,
- org.eclipse.papyrus.uml.diagram.activity.navigator,
- org.eclipse.papyrus.uml.diagram.activity.parser.custom,
- org.eclipse.papyrus.uml.diagram.activity.parsers,
- org.eclipse.papyrus.uml.diagram.activity.part,
- org.eclipse.papyrus.uml.diagram.activity.preferences,
- org.eclipse.papyrus.uml.diagram.activity.providers,
- org.eclipse.papyrus.uml.diagram.activity.sheet,
- org.eclipse.papyrus.uml.diagram.activity.tabbedproperties.appearance,
- org.eclipse.papyrus.uml.diagram.activity.testers
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibility:=reexport,
- org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
- org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)";visibility:=reexport,
- org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.emf.validation.ocl;bundle-version="[1.4.0,2.0.0)";visibility:=reexport,
- org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)",
- org.eclipse.papyrus.infra.hyperlink;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
- org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)";visibility:=reexport,
- org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)"
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 3.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.activity; singleton:=true
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.activity, + org.eclipse.papyrus.uml.diagram.activity.commands, + org.eclipse.papyrus.uml.diagram.activity.draw2d, + org.eclipse.papyrus.uml.diagram.activity.edit.actions, + org.eclipse.papyrus.uml.diagram.activity.edit.advices, + org.eclipse.papyrus.uml.diagram.activity.edit.commands, + org.eclipse.papyrus.uml.diagram.activity.edit.dialogs, + org.eclipse.papyrus.uml.diagram.activity.edit.helpers, + org.eclipse.papyrus.uml.diagram.activity.edit.part, + org.eclipse.papyrus.uml.diagram.activity.edit.part.ActivityGroup;x-friends:=org.eclipse.papyrus.uml.diagram.activity.tests, + org.eclipse.papyrus.uml.diagram.activity.edit.parts, + org.eclipse.papyrus.uml.diagram.activity.edit.policies, + org.eclipse.papyrus.uml.diagram.activity.expressions, + org.eclipse.papyrus.uml.diagram.activity.figures, + org.eclipse.papyrus.uml.diagram.activity.handlers, + org.eclipse.papyrus.uml.diagram.activity.helper, + org.eclipse.papyrus.uml.diagram.activity.listeners, + org.eclipse.papyrus.uml.diagram.activity.locator, + org.eclipse.papyrus.uml.diagram.activity.migration, + org.eclipse.papyrus.uml.diagram.activity.navigator, + org.eclipse.papyrus.uml.diagram.activity.parser.custom, + org.eclipse.papyrus.uml.diagram.activity.parsers, + org.eclipse.papyrus.uml.diagram.activity.part, + org.eclipse.papyrus.uml.diagram.activity.preferences, + org.eclipse.papyrus.uml.diagram.activity.providers, + org.eclipse.papyrus.uml.diagram.activity.sheet, + org.eclipse.papyrus.uml.diagram.activity.tabbedproperties.appearance, + org.eclipse.papyrus.uml.diagram.activity.testers +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibility:=reexport, + org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)", + org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)", + org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)", + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", + org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, + org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.emf.validation.ocl;bundle-version="[1.4.0,2.0.0)";visibility:=reexport, + org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)", + org.eclipse.papyrus.infra.hyperlink;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, + org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" +Bundle-Vendor: %providerName +Eclipse-LazyStart: true +Bundle-Version: 3.0.0.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.activity; singleton:=true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/UmlActivityDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/UmlActivityDiagramForMultiEditor.java index 77447b27327..ea4bf393c1d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/UmlActivityDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/UmlActivityDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * Contributors: * Atos Origin - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.activity; @@ -30,6 +31,7 @@ import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditor; import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; @@ -85,7 +87,7 @@ public class UmlActivityDiagramForMultiEditor extends UMLDiagramEditor { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallBehaviorActionPinUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallBehaviorActionPinUpdater.java index 616d142be1c..5d8730951c5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallBehaviorActionPinUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallBehaviorActionPinUpdater.java @@ -1,86 +1,101 @@ -/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * 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:
- * Jérémie TATIBOUET (CEA LIST) - Initial API and implementation
- * Sébastien REVOL (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.uml2.uml.CallBehaviorAction;
-import org.eclipse.uml2.uml.InputPin;
-import org.eclipse.uml2.uml.OutputPin;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CallBehaviorActionPinUpdater extends AbstractCallActionPinUpdater<CallBehaviorAction> {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#deriveResults()
- *
- * @return
- */
- @Override
- public List<OutputPin> deriveResults(CallBehaviorAction node) {
- List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>();
- if (node.getBehavior() != null) {
- for (Parameter parameter : node.getBehavior().getOwnedParameters()) {
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) {
- OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin();
- derivedPin.setType(parameter.getType());
- derivedPin.setLower(parameter.getLower());
- derivedPin.setUpper(parameter.getUpper());
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) {
- derivedPin.setName("[out] " + parameter.getName());
- } else {
- derivedPin.setName(parameter.getName());
- }
- derivedOutputPins.add(derivedPin);
- }
- }
- }
- return derivedOutputPins;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments()
- *
- * @return
- */
- @Override
- public List<InputPin> deriveArguments(CallBehaviorAction node) {
- List<InputPin> derivedInputPins = new ArrayList<InputPin>();
- if (node.getBehavior() != null) {
- for (Parameter parameter : node.getBehavior().getOwnedParameters()) {
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.IN_LITERAL) {
- InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin();
- derivedPin.setType(parameter.getType());
- derivedPin.setLower(parameter.getLower());
- derivedPin.setUpper(parameter.getUpper());
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) {
- derivedPin.setName("[in] " + parameter.getName());
- } else {
- derivedPin.setName(parameter.getName());
- }
- derivedInputPins.add(derivedPin);
- }
- }
- }
- return derivedInputPins;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * J�r�mie TATIBOUET (CEA LIST) - Initial API and implementation + * S�bastien REVOL (CEA LIST) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CallBehaviorAction; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.OutputPin; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.UMLFactory; + +public class CallBehaviorActionPinUpdater extends AbstractCallActionPinUpdater<CallBehaviorAction> { + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#deriveResults() + * + * @return + */ + @Override + public List<OutputPin> deriveResults(CallBehaviorAction node) { + List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>(); + if (node.getBehavior() != null) { + for (Parameter parameter : node.getBehavior().getOwnedParameters()) { + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL + || parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL + || parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) { + OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin(); + derivedOutputPins.add(derivedPin); + derivedPin.setType(parameter.getType()); + derivedPin.setLower(parameter.getLower()); + derivedPin.setUpper(parameter.getUpper()); + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { + derivedPin.setName("[out] " + parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, "[out] " + UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } else { + derivedPin.setName(parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } + } + } + } + return derivedOutputPins; + } + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments() + * + * @return + */ + @Override + public List<InputPin> deriveArguments(CallBehaviorAction node) { + List<InputPin> derivedInputPins = new ArrayList<InputPin>(); + if (node.getBehavior() != null) { + for (Parameter parameter : node.getBehavior().getOwnedParameters()) { + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL + || parameter.getDirection() == ParameterDirectionKind.IN_LITERAL) { + InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin(); + derivedInputPins.add(derivedPin); + derivedPin.setType(parameter.getType()); + derivedPin.setLower(parameter.getLower()); + derivedPin.setUpper(parameter.getUpper()); + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { + derivedPin.setName("[in] " + parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, "[in] " + UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } else { + derivedPin.setName(parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } + } + } + } + return derivedInputPins; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallOperationActionPinUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallOperationActionPinUpdater.java index 740970dd592..29404da2dee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallOperationActionPinUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/CallOperationActionPinUpdater.java @@ -1,126 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * 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:
- * Jérémie TATIBOUET (CEA LIST) - Initial API and implementation
- * Sébastien REVOL (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.uml2.uml.CallOperationAction;
-import org.eclipse.uml2.uml.InputPin;
-import org.eclipse.uml2.uml.OutputPin;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CallOperationActionPinUpdater extends AbstractCallActionPinUpdater<CallOperationAction> {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#updatePins(org.eclipse.uml2.uml.CallAction)
- *
- * @param node
- */
- @Override
- public void updatePins(CallOperationAction node) {
- // Update both arguments and results
- super.updatePins(node);
- // Ensure a target is set for this operation call
- InputPin targetPin = this.deriveTarget(node);
- if (node.getTarget() == null) {
- node.setTarget(targetPin);
- } else {
- update(node.getTarget(), targetPin);
- }
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveTarget(org.eclipse.uml2.uml.InvocationAction)
- *
- * @param node
- * @return
- */
- @Override
- public InputPin deriveTarget(CallOperationAction node) {
- InputPin pinTarget = UMLFactory.eINSTANCE.createInputPin();
- pinTarget.setLower(1);
- pinTarget.setUpper(1);
- pinTarget.setName(TARGET_NAME);
- if (node.getOperation() != null) {
- pinTarget.setType(node.getOperation().getClass_());
- }
- return pinTarget;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments(org.eclipse.uml2.uml.InvocationAction)
- *
- * @param node
- * @return
- */
- @Override
- public List<InputPin> deriveArguments(CallOperationAction node) {
- List<InputPin> derivedInputPins = new ArrayList<InputPin>();
- if (node.getOperation() != null) {
- for (Parameter parameter : node.getOperation().getOwnedParameters()) {
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.IN_LITERAL) {
- InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin();
- derivedPin.setType(parameter.getType());
- derivedPin.setLower(parameter.getLower());
- derivedPin.setUpper(parameter.getUpper());
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) {
- derivedPin.setName("[in] " + parameter.getName());
- } else {
- derivedPin.setName(parameter.getName());
- }
- derivedInputPins.add(derivedPin);
- }
- }
- }
- return derivedInputPins;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#deriveResults(org.eclipse.uml2.uml.CallAction)
- *
- * @param node
- * @return
- */
- @Override
- public List<OutputPin> deriveResults(CallOperationAction node) {
- List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>();
- if (node.getOperation() != null) {
- for (Parameter parameter : node.getOperation().getOwnedParameters()) {
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL
- || parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) {
- OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin();
- derivedPin.setType(parameter.getType());
- derivedPin.setLower(parameter.getLower());
- derivedPin.setUpper(parameter.getUpper());
- if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) {
- derivedPin.setName("[out] " + parameter.getName());
- } else {
- derivedPin.setName(parameter.getName());
- }
- derivedOutputPins.add(derivedPin);
- }
- }
- }
- return derivedOutputPins;
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * J�r�mie TATIBOUET (CEA LIST) - Initial API and implementation + * S�bastien REVOL (CEA LIST) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CallOperationAction; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.OutputPin; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.UMLFactory; + +public class CallOperationActionPinUpdater extends AbstractCallActionPinUpdater<CallOperationAction> { + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#updatePins(org.eclipse.uml2.uml.CallAction) + * + * @param node + */ + @Override + public void updatePins(CallOperationAction node) { + // Update both arguments and results + super.updatePins(node); + // Ensure a target is set for this operation call + InputPin targetPin = this.deriveTarget(node); + if (node.getTarget() == null) { + node.setTarget(targetPin); + } else { + update(node.getTarget(), targetPin); + } + } + + /** + * + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveTarget(org.eclipse.uml2.uml.InvocationAction) + * + * @param node + * @return + */ + @Override + public InputPin deriveTarget(CallOperationAction node) { + InputPin pinTarget = UMLFactory.eINSTANCE.createInputPin(); + pinTarget.setLower(1); + pinTarget.setUpper(1); + pinTarget.setName(TARGET_NAME); + if (node.getOperation() != null) { + pinTarget.setType(node.getOperation().getClass_()); + } + return pinTarget; + } + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments(org.eclipse.uml2.uml.InvocationAction) + * + * @param node + * @return + */ + @Override + public List<InputPin> deriveArguments(CallOperationAction node) { + List<InputPin> derivedInputPins = new ArrayList<InputPin>(); + if (node.getOperation() != null) { + for (Parameter parameter : node.getOperation().getOwnedParameters()) { + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL + || parameter.getDirection() == ParameterDirectionKind.IN_LITERAL) { + InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin(); + derivedInputPins.add(derivedPin); + derivedPin.setType(parameter.getType()); + derivedPin.setLower(parameter.getLower()); + derivedPin.setUpper(parameter.getUpper()); + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { + derivedPin.setName("[in] " + parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, "[in] " + UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } else { + derivedPin.setName(parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } + } + } + } + return derivedInputPins; + } + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractCallActionPinUpdater#deriveResults(org.eclipse.uml2.uml.CallAction) + * + * @param node + * @return + */ + @Override + public List<OutputPin> deriveResults(CallOperationAction node) { + List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>(); + if (node.getOperation() != null) { + for (Parameter parameter : node.getOperation().getOwnedParameters()) { + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL + || parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL + || parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) { + OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin(); + derivedOutputPins.add(derivedPin); + derivedPin.setType(parameter.getType()); + derivedPin.setLower(parameter.getLower()); + derivedPin.setUpper(parameter.getUpper()); + if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { + derivedPin.setName("[out] " + parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, "[out] " + UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } else { + derivedPin.setName(parameter.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter), null); + } + } + } + } + } + return derivedOutputPins; + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/SendSignalActionPinUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/SendSignalActionPinUpdater.java index 890f4b7933a..2ffb0b58e16 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/SendSignalActionPinUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/SendSignalActionPinUpdater.java @@ -1,166 +1,172 @@ -/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * 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:
- * Jérémie TATIBOUET (CEA LIST) - Initial API and implementation
- * Sébastien REVOL (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
-import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
-import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.InputPin;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Reception;
-import org.eclipse.uml2.uml.SendSignalAction;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class SendSignalActionPinUpdater extends AbstractInvocationActionPinUpdater<SendSignalAction> {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#updatePins(org.eclipse.uml2.uml.InvocationAction)
- *
- * @param node
- */
- @Override
- public void updatePins(SendSignalAction node) {
- // Update arguments
- super.updatePins(node);
- // Update target
- InputPin targetPin = this.deriveTarget(node);
- if (node.getTarget() == null) {
- node.setTarget(targetPin);
- } else {
- update(node.getTarget(), targetPin);
- }
- }
-
- private static boolean canReceive(Class clazz, Signal signal) {
- Reception matchingReception = null;
- Iterator<Reception> receptionsIterator = clazz.getOwnedReceptions().iterator();
- while (matchingReception == null && receptionsIterator.hasNext()) {
- Reception currentReception = receptionsIterator.next();
- if (currentReception.getSignal() != null) {
- matchingReception = currentReception.getSignal().conformsTo(signal) ? currentReception : null;
- }
- }
- return matchingReception != null;
- }
-
- /**
- * Derive the type of the target in the context of a SendSignalAction. Three cases are supported:
- *
- * 1] A port is specified to send the signal. In the theory, this port must be owned the class realizing the sending. Hence
- * the type chosen for the target is the class owning the port.
- *
- * 2] The node already has a typed target pin. Make sure this type is still correct. This is evaluated by checking if
- * the type has a reception for chosen signal. If it is the case the type is reused, otherwise the only remaining solution
- * is to propose to the user all classes having a reception on the signal referenced by the action.
- *
- * @param node
- * the send signal action for which the target type is derived
- *
- * @return the derived type or null
- */
- private Type deriveTargetType(SendSignalAction node) {
- Type targetPinType = null;
- if (node.getOnPort() != null) {
- // If a port is specified it is possible to propose a type for the target pin. The type
- // is the type of class owning the port. This proposal might not be always right however it
- // if the signal is sent through a port it reasonable to think that the target used for the
- // send is of the type of the port owner.
- targetPinType = node.getOnPort().getClass_();
- } else {
- if (node.getTarget() != null) {
- Type currentTargetPinType = node.getTarget().getType();
- if (currentTargetPinType instanceof Class && canReceive((Class) currentTargetPinType, node.getSignal())) {
- targetPinType = currentTargetPinType;
- }
- }
- if (targetPinType == null && Display.getCurrent() !=null) {
- // In this case there is no automated derivation possible. Indeed at most we can only propose
- // to the user to choose among a list of type being able to accept the arrival of the signal
- // specified for the given action.
- //
- // Note: This can only be realized if this code is called from UI thread
- InputPin currentTargetPin = node.getTarget();
- if (currentTargetPin == null) {
- node.setTarget(UMLFactory.eINSTANCE.createInputPin());
- }
- UMLContentProvider provider = new UMLContentProvider(node.getTarget(), UMLPackage.eINSTANCE.getTypedElement_Type());
- TreeSelectorDialog dialog = new TreeSelectorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
- dialog.setTitle("Select type");
- dialog.setDescription("Select type for target input pin");
- dialog.setContentProvider(provider);
- dialog.setLabelProvider(new UMLLabelProvider());
- int userResponse = dialog.open();
- if (userResponse == Window.OK) {
- Object[] result = dialog.getResult();
- if (result != null && result.length > 0 && result[0] instanceof Type) {
- targetPinType = (Type) result[0];
- }
- }
- node.setTarget(currentTargetPin);
- }
- }
- return targetPinType;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveTarget(org.eclipse.uml2.uml.InvocationAction)
- *
- * @param node
- * @return
- */
- @Override
- public InputPin deriveTarget(SendSignalAction node) {
- InputPin targetPin = UMLFactory.eINSTANCE.createInputPin();
- targetPin.setLower(1);
- targetPin.setUpper(1);
- targetPin.setName(TARGET_NAME);
- targetPin.setType(this.deriveTargetType(node));
- return targetPin;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments(org.eclipse.uml2.uml.InvocationAction)
- *
- * @param node
- * @return
- */
- @Override
- public List<InputPin> deriveArguments(SendSignalAction node) {
- List<InputPin> derivedInputPins = new ArrayList<InputPin>();
- if (node.getSignal() != null) {
- for (Property property : node.getSignal().getAllAttributes()) {
- InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin();
- derivedPin.setLower(property.getLower());
- derivedPin.setUpper(property.getUpper());
- derivedPin.setType(property.getType());
- derivedPin.setName(property.getName());
- derivedInputPins.add(derivedPin);
- }
- }
- return derivedInputPins;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * J�r�mie TATIBOUET (CEA LIST) - Initial API and implementation + * S�bastien REVOL (CEA LIST) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider; +import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Reception; +import org.eclipse.uml2.uml.SendSignalAction; +import org.eclipse.uml2.uml.Signal; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +public class SendSignalActionPinUpdater extends AbstractInvocationActionPinUpdater<SendSignalAction> { + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#updatePins(org.eclipse.uml2.uml.InvocationAction) + * + * @param node + */ + @Override + public void updatePins(SendSignalAction node) { + // Update arguments + super.updatePins(node); + // Update target + InputPin targetPin = this.deriveTarget(node); + if (node.getTarget() == null) { + node.setTarget(targetPin); + } else { + update(node.getTarget(), targetPin); + } + } + + private static boolean canReceive(Class clazz, Signal signal) { + Reception matchingReception = null; + Iterator<Reception> receptionsIterator = clazz.getOwnedReceptions().iterator(); + while (matchingReception == null && receptionsIterator.hasNext()) { + Reception currentReception = receptionsIterator.next(); + if (currentReception.getSignal() != null) { + matchingReception = currentReception.getSignal().conformsTo(signal) ? currentReception : null; + } + } + return matchingReception != null; + } + + /** + * Derive the type of the target in the context of a SendSignalAction. Three cases are supported: + * + * 1] A port is specified to send the signal. In the theory, this port must be owned the class realizing the sending. Hence + * the type chosen for the target is the class owning the port. + * + * 2] The node already has a typed target pin. Make sure this type is still correct. This is evaluated by checking if + * the type has a reception for chosen signal. If it is the case the type is reused, otherwise the only remaining solution + * is to propose to the user all classes having a reception on the signal referenced by the action. + * + * @param node + * the send signal action for which the target type is derived + * + * @return the derived type or null + */ + private Type deriveTargetType(SendSignalAction node) { + Type targetPinType = null; + if (node.getOnPort() != null) { + // If a port is specified it is possible to propose a type for the target pin. The type + // is the type of class owning the port. This proposal might not be always right however it + // if the signal is sent through a port it reasonable to think that the target used for the + // send is of the type of the port owner. + targetPinType = node.getOnPort().getClass_(); + } else { + if (node.getTarget() != null) { + Type currentTargetPinType = node.getTarget().getType(); + if (currentTargetPinType instanceof Class && canReceive((Class) currentTargetPinType, node.getSignal())) { + targetPinType = currentTargetPinType; + } + } + if (targetPinType == null && Display.getCurrent() !=null) { + // In this case there is no automated derivation possible. Indeed at most we can only propose + // to the user to choose among a list of type being able to accept the arrival of the signal + // specified for the given action. + // + // Note: This can only be realized if this code is called from UI thread + InputPin currentTargetPin = node.getTarget(); + if (currentTargetPin == null) { + node.setTarget(UMLFactory.eINSTANCE.createInputPin()); + } + UMLContentProvider provider = new UMLContentProvider(node.getTarget(), UMLPackage.eINSTANCE.getTypedElement_Type()); + TreeSelectorDialog dialog = new TreeSelectorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()); + dialog.setTitle("Select type"); + dialog.setDescription("Select type for target input pin"); + dialog.setContentProvider(provider); + dialog.setLabelProvider(new UMLLabelProvider()); + int userResponse = dialog.open(); + if (userResponse == Window.OK) { + Object[] result = dialog.getResult(); + if (result != null && result.length > 0 && result[0] instanceof Type) { + targetPinType = (Type) result[0]; + } + } + node.setTarget(currentTargetPin); + } + } + return targetPinType; + } + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveTarget(org.eclipse.uml2.uml.InvocationAction) + * + * @param node + * @return + */ + @Override + public InputPin deriveTarget(SendSignalAction node) { + InputPin targetPin = UMLFactory.eINSTANCE.createInputPin(); + targetPin.setLower(1); + targetPin.setUpper(1); + targetPin.setName(TARGET_NAME); + targetPin.setType(this.deriveTargetType(node)); + return targetPin; + } + + /** + * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractInvocationActionPinUpdater#deriveArguments(org.eclipse.uml2.uml.InvocationAction) + * + * @param node + * @return + */ + @Override + public List<InputPin> deriveArguments(SendSignalAction node) { + List<InputPin> derivedInputPins = new ArrayList<InputPin>(); + if (node.getSignal() != null) { + for (Property property : node.getSignal().getAllAttributes()) { + InputPin derivedPin = UMLFactory.eINSTANCE.createInputPin(); + derivedInputPins.add(derivedPin); + derivedPin.setLower(property.getLower()); + derivedPin.setUpper(property.getUpper()); + derivedPin.setType(property.getType()); + derivedPin.setName(property.getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(property) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(property)) { + UMLLabelInternationalization.getInstance().setLabel(derivedPin, UMLLabelInternationalization.getInstance().getLabelWithoutUML(property), null); + } + } + } + return derivedInputPins; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/handlers/SynchronizePinsParametersHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/handlers/SynchronizePinsParametersHandler.java index 832cc9fc19b..768440c420f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/handlers/SynchronizePinsParametersHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/handlers/SynchronizePinsParametersHandler.java @@ -11,6 +11,7 @@ * Arthur Daussy (Atos) - Initial API and implementation * Arthur Daussy - 371712 : [Activitydiagram] Papyrus should provide a way to manually resynchronize pins and parameters on Call Actions * Olivier Mélois (Atos) : olivier.melois@atos.net - 371712 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.activity.handlers; @@ -65,6 +66,7 @@ import org.eclipse.papyrus.uml.diagram.activity.helper.IPinToParameterLinkComman import org.eclipse.papyrus.uml.diagram.activity.helper.PinAndParameterSynchronizer; import org.eclipse.papyrus.uml.diagram.activity.helper.datastructure.LinkPinToParameter; import org.eclipse.papyrus.uml.diagram.activity.providers.UMLMarkerNavigationProvider; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; @@ -378,7 +380,7 @@ public class SynchronizePinsParametersHandler extends AbstractSynchronizePinsAnd for (ActivityEdge activityEdge : dialog.getEgdesToDelete()) { // Create a marker for all deleted edges if (!newHashSet.isEmpty()) { - UMLItemProviderAdapterFactory umlAdapterFactory = new UMLItemProviderAdapterFactory(); + InternationalizationUMLItemProviderAdapterFactory umlAdapterFactory = new InternationalizationUMLItemProviderAdapterFactory(); IItemLabelProvider edgeLabelProvider = (IItemLabelProvider) umlAdapterFactory.adapt(activityEdge, IItemLabelProvider.class); IItemLabelProvider callActionLabelProvider = (IItemLabelProvider) umlAdapterFactory.adapt(invocationAction, IItemLabelProvider.class); UMLMarkerNavigationProvider.addMarker(target, activityEdge.eResource().getURIFragment(activityEdge), EMFCoreUtil.getQualifiedName(invocationAction, true), "The edge " + edgeLabelProvider.getText(activityEdge) @@ -635,7 +637,7 @@ public class SynchronizePinsParametersHandler extends AbstractSynchronizePinsAnd } private String getEdgeListString() { - UMLItemProviderAdapterFactory t = new UMLItemProviderAdapterFactory(); + InternationalizationUMLItemProviderAdapterFactory t = new InternationalizationUMLItemProviderAdapterFactory(); IItemLabelProvider provider = (IItemLabelProvider) t.adapt(callAction, IItemLabelProvider.class); StringBuilder builder = new StringBuilder("If you synchronize " + provider.getText(callAction) + " the following edges will be deleted : \n ");//$NON-NLS-1$ //$NON-NLS-2$ for (ActivityEdge e : egdes) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinLabelHelper.java index 3067cc6e2c1..04625899f3d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinLabelHelper.java @@ -1,3 +1,16 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.activity.helper; import java.util.Collection; @@ -10,6 +23,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.uml.diagram.common.Messages; import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.TypeUtil; import org.eclipse.uml2.uml.Element; @@ -65,12 +79,13 @@ public class PinLabelHelper extends StereotypedElementLabelHelper { StringBuffer buffer = new StringBuffer(); if (maskValues.contains(ICustomAppearance.DISP_NAME)) { buffer.append(" "); - buffer.append(namedElement.getName()== null ? "" : namedElement.getName()); + String name = UMLLabelInternationalization.getInstance().getLabel(namedElement); + buffer.append(null == name ? "" : name); } if (namedElement instanceof TypedElement) { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { if (((TypedElement) namedElement).getType() != null) { - buffer.append(": " + ((TypedElement) namedElement).getType().getName()); + buffer.append(": " + UMLLabelInternationalization.getInstance().getLabel(((TypedElement) namedElement).getType())); } else { buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptEventActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptEventActionParser.java index 9a19b2cfbbb..54e73b7ad69 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptEventActionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptEventActionParser.java @@ -1,140 +1,142 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.AcceptEventAction;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Trigger;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the label of an AcceptEventAction (not in
- * AcceptTimeEventAction mode). This parser refreshes the text displayed for the
- * Action.
- */
-public class AcceptEventActionParser extends MessageFormatParser implements ISemanticParser {
-
- public AcceptEventActionParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public AcceptEventActionParser(EAttribute[] features) {
- super(features);
- }
-
- public AcceptEventActionParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof AcceptEventAction) {
- AcceptEventAction action = (AcceptEventAction) obj;
- String name = action.getName();
- if (name != null) {// && !CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(action)) {
- return name;
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof AcceptEventAction) {
- AcceptEventAction action = (AcceptEventAction) element;
- semanticElementsBeingParsed.add(action);
- if (action.getTriggers() != null) {
- for (Trigger trigger : action.getTriggers()) {
- if (trigger != null) {
- semanticElementsBeingParsed.add(trigger);
- }
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getAcceptEventAction_Trigger().equals(feature) || UMLPackage.eINSTANCE.getTrigger_Event().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.AcceptEventAction; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Trigger; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the label of an AcceptEventAction (not in + * AcceptTimeEventAction mode). This parser refreshes the text displayed for the + * Action. + */ +public class AcceptEventActionParser extends MessageFormatParser implements ISemanticParser { + + public AcceptEventActionParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public AcceptEventActionParser(EAttribute[] features) { + super(features); + } + + public AcceptEventActionParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof AcceptEventAction) { + AcceptEventAction action = (AcceptEventAction) obj; + String name = UMLLabelInternationalization.getInstance().getLabel(action); + if (name != null) {// && !CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(action)) { + return name; + } + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof AcceptEventAction) { + AcceptEventAction action = (AcceptEventAction) element; + semanticElementsBeingParsed.add(action); + if (action.getTriggers() != null) { + for (Trigger trigger : action.getTriggers()) { + if (trigger != null) { + semanticElementsBeingParsed.add(trigger); + } + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getAcceptEventAction_Trigger().equals(feature) || UMLPackage.eINSTANCE.getTrigger_Event().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptTimeEventActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptTimeEventActionParser.java index ea0f9234178..d1dee402d6d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptTimeEventActionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AcceptTimeEventActionParser.java @@ -1,141 +1,143 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.helper.CustomAcceptEventActionEditHelper;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.AcceptEventAction;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Trigger;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the label of an AcceptEventAction (only in
- * AcceptTimeEventAction mode). This parser refreshes the text displayed for the
- * Action.
- */
-public class AcceptTimeEventActionParser extends MessageFormatParser implements ISemanticParser {
-
- public AcceptTimeEventActionParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public AcceptTimeEventActionParser(EAttribute[] features) {
- super(features);
- }
-
- public AcceptTimeEventActionParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof AcceptEventAction) {
- AcceptEventAction action = (AcceptEventAction) obj;
- String name = action.getName();
- if (name != null && CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(action)) {
- return name;
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof AcceptEventAction) {
- AcceptEventAction action = (AcceptEventAction) element;
- semanticElementsBeingParsed.add(action);
- if (action.getTriggers() != null) {
- for (Trigger trigger : action.getTriggers()) {
- if (trigger != null) {
- semanticElementsBeingParsed.add(trigger);
- }
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getAcceptEventAction_Trigger().equals(feature) || UMLPackage.eINSTANCE.getTrigger_Event().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.helper.CustomAcceptEventActionEditHelper; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.AcceptEventAction; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Trigger; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the label of an AcceptEventAction (only in + * AcceptTimeEventAction mode). This parser refreshes the text displayed for the + * Action. + */ +public class AcceptTimeEventActionParser extends MessageFormatParser implements ISemanticParser { + + public AcceptTimeEventActionParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public AcceptTimeEventActionParser(EAttribute[] features) { + super(features); + } + + public AcceptTimeEventActionParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof AcceptEventAction) { + AcceptEventAction action = (AcceptEventAction) obj; + String name = UMLLabelInternationalization.getInstance().getLabel(action); + if (name != null && CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(action)) { + return name; + } + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof AcceptEventAction) { + AcceptEventAction action = (AcceptEventAction) element; + semanticElementsBeingParsed.add(action); + if (action.getTriggers() != null) { + for (Trigger trigger : action.getTriggers()) { + if (trigger != null) { + semanticElementsBeingParsed.add(trigger); + } + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getAcceptEventAction_Trigger().equals(feature) || UMLPackage.eINSTANCE.getTrigger_Event().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityEdgeWeightParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityEdgeWeightParser.java index 13b0ee35d03..687df7a28cf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityEdgeWeightParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityEdgeWeightParser.java @@ -1,190 +1,191 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ActivityEdge;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for displaying the weight of an Activity Edge. This parser
- * refreshes the text displayed for the weight.
- */
-public class ActivityEdgeWeightParser extends MessageFormatParser implements ISemanticParser {
-
- /** The format string for displaying the weight */
- private static final String WEIGHT_FORMAT = "{weight=%s}";
-
- public ActivityEdgeWeightParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ActivityEdgeWeightParser(EAttribute[] features) {
- super(features);
- }
-
- public ActivityEdgeWeightParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- String value = getValueString(adapter, flags);
- if (value != null) {
- return value;
- }
- return "";
- }
-
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- if (obj instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) obj;
- ValueSpecification valueSpec = edge.getWeight();
- if (valueSpec != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString)));
- return command;
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String label = getValueString(element, flags);
- if (label == null || label.length() == 0) {
- label = " ";
- } else {
- label = String.format(WEIGHT_FORMAT, label);
- }
- return label;
- }
-
- /**
- * Get the unformatted registered string value which shall be displayed
- */
- private String getValueString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) obj;
- ValueSpecification valueSpec = edge.getWeight();
- if (valueSpec != null) {
- String value = ValueSpecificationUtil.getSpecificationValue(valueSpec);
- if (value != null) {
- return value;
- }
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) element;
- semanticElementsBeingParsed.add(edge);
- if (edge.getWeight() != null) {
- semanticElementsBeingParsed.add(edge.getWeight());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getActivityEdge_Weight().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass());
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.ActivityEdge; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * A specific parser for displaying the weight of an Activity Edge. This parser + * refreshes the text displayed for the weight. + */ +public class ActivityEdgeWeightParser extends MessageFormatParser implements ISemanticParser { + + /** The format string for displaying the weight */ + private static final String WEIGHT_FORMAT = "{weight=%s}"; + + public ActivityEdgeWeightParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public ActivityEdgeWeightParser(EAttribute[] features) { + super(features); + } + + public ActivityEdgeWeightParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + @Override + public String getEditString(IAdaptable adapter, int flags) { + String value = getValueString(adapter, flags, false); + if (value != null) { + return value; + } + return ""; + } + + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object obj = adapter.getAdapter(EObject.class); + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + if (obj instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) obj; + ValueSpecification valueSpec = edge.getWeight(); + if (valueSpec != null) { + CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$ + command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString))); + return command; + } + } + return UnexecutableCommand.INSTANCE; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String label = getValueString(element, flags, true); + if (label == null || label.length() == 0) { + label = " "; + } else { + label = String.format(WEIGHT_FORMAT, label); + } + return label; + } + + /** + * Get the unformatted registered string value which shall be displayed + */ + private String getValueString(IAdaptable element, int flags, final boolean useInternationalizayion) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) obj; + ValueSpecification valueSpec = edge.getWeight(); + if (valueSpec != null) { + String value = ValueSpecificationUtil.getSpecificationValue(valueSpec, useInternationalizayion); + if (value != null) { + return value; + } + } + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) element; + semanticElementsBeingParsed.add(edge); + if (edge.getWeight() != null) { + semanticElementsBeingParsed.add(edge.getWeight()); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getActivityEdge_Weight().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass()); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityParameterNodeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityParameterNodeParser.java index be936cd9027..f7ed4961cd0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityParameterNodeParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ActivityParameterNodeParser.java @@ -1,174 +1,176 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.ActivityParameterNode;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * The Class ActivityParameterNodeParser.
- */
-public class ActivityParameterNodeParser extends MessageFormatParser implements ISemanticParser {
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with no
- * type
- */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with its
- * type
- */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with in
- * State property
- */
- private static final String STATE_FORMAT = System.getProperty("line.separator").concat("[%s]");
-
- /** The String for separating states */
- private static final String STATE_SEPARATOR = ", ";
-
- public ActivityParameterNodeParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public ActivityParameterNodeParser(EAttribute[] features) {
- super(features);
- }
-
- public ActivityParameterNodeParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- ActivityParameterNode parameterNode = null;
- Object adapter = element.getAdapter(EObject.class);
- if (adapter instanceof ActivityParameterNode) {
- parameterNode = (ActivityParameterNode) adapter;
- String name = parameterNode.getName();
- result = String.format(UNTYPED_PARAMETER_FORMAT, name);
- // manage type
- if (parameterNode.getType() != null) {
- String type = parameterNode.getType().getName();
- result = String.format(TYPED_PARAMETER_FORMAT, name, type);
- }
- // manage states
- StringBuffer stateLabel = new StringBuffer();
- for (State state : parameterNode.getInStates()) {
- String stateName = state.getName();
- if (stateName == null) {
- stateName = "";
- }
- if (!"".equals(stateName)) {
- if (stateLabel.length() > 0) {
- stateLabel.append(STATE_SEPARATOR);
- }
- stateLabel.append(stateName);
- }
- }
- if (stateLabel.length() > 0) {
- result += String.format(STATE_FORMAT, stateLabel.toString());
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- ActivityParameterNode parameterNode = null;
- if (element instanceof ActivityParameterNode) {
- parameterNode = (ActivityParameterNode) element;
- semanticElementsBeingParsed.add(parameterNode);
- if (parameterNode.getType() != null) {
- semanticElementsBeingParsed.add(parameterNode.getType());
- }
- if (parameterNode.getInStates() != null && !parameterNode.getInStates().isEmpty()) {
- semanticElementsBeingParsed.addAll(parameterNode.getInStates());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.ActivityParameterNode; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.State; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * The Class ActivityParameterNodeParser. + */ +public class ActivityParameterNodeParser extends MessageFormatParser implements ISemanticParser { + + /** + * The String format for displaying an ActivityParameterNodeParser with no + * type + */ + private static final String UNTYPED_PARAMETER_FORMAT = "%s"; + + /** + * The String format for displaying an ActivityParameterNodeParser with its + * type + */ + private static final String TYPED_PARAMETER_FORMAT = "%s: %s"; + + /** + * The String format for displaying an ActivityParameterNodeParser with in + * State property + */ + private static final String STATE_FORMAT = System.getProperty("line.separator").concat("[%s]"); + + /** The String for separating states */ + private static final String STATE_SEPARATOR = ", "; + + public ActivityParameterNodeParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + public ActivityParameterNodeParser(EAttribute[] features) { + super(features); + } + + public ActivityParameterNodeParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * Gets the e structural feature. + * + * @param notification + * @return the structural feature + */ + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String result = ""; + ActivityParameterNode parameterNode = null; + Object adapter = element.getAdapter(EObject.class); + if (adapter instanceof ActivityParameterNode) { + parameterNode = (ActivityParameterNode) adapter; + String name = UMLLabelInternationalization.getInstance().getLabel(parameterNode); + result = String.format(UNTYPED_PARAMETER_FORMAT, name); + // manage type + if (parameterNode.getType() != null) { + String type = UMLLabelInternationalization.getInstance().getLabel(parameterNode.getType()); + result = String.format(TYPED_PARAMETER_FORMAT, name, type); + } + // manage states + StringBuffer stateLabel = new StringBuffer(); + for (State state : parameterNode.getInStates()) { + String stateName = UMLLabelInternationalization.getInstance().getLabel(state); + if (stateName == null) { + stateName = ""; + } + if (!"".equals(stateName)) { + if (stateLabel.length() > 0) { + stateLabel.append(STATE_SEPARATOR); + } + stateLabel.append(stateName); + } + } + if (stateLabel.length() > 0) { + result += String.format(STATE_FORMAT, stateLabel.toString()); + } + } + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("unchecked") + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + ActivityParameterNode parameterNode = null; + if (element instanceof ActivityParameterNode) { + parameterNode = (ActivityParameterNode) element; + semanticElementsBeingParsed.add(parameterNode); + if (parameterNode.getType() != null) { + semanticElementsBeingParsed.add(parameterNode.getType()); + } + if (parameterNode.getInStates() != null && !parameterNode.getInStates().isEmpty()) { + semanticElementsBeingParsed.addAll(parameterNode.getInStates()); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AssociatedBehaviorParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AssociatedBehaviorParser.java index 445a050add0..c7c4d34fa53 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AssociatedBehaviorParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/AssociatedBehaviorParser.java @@ -1,192 +1,198 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying a behavior which is associated to an
- * element. This parser refreshes the text displayed for the behavior.
- */
-public abstract class AssociatedBehaviorParser extends MessageFormatParser implements ISemanticParser {
-
- public AssociatedBehaviorParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public AssociatedBehaviorParser(EAttribute[] features) {
- super(features);
- }
-
- public AssociatedBehaviorParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- String value = getValueString(adapter, flags);
- if (value != null) {
- return value;
- }
- return "";
- }
-
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- if (getReferenceFeature().getContainerClass().isInstance(obj)) {
- Object behavior = ((EObject) obj).eGet(getReferenceFeature());
- if (behavior instanceof Behavior) {
- return getModificationCommand((EObject) behavior, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String label = getValueString(element, flags);
- if (label == null || label.length() == 0) {
- label = "";
- } else {
- label = String.format(getFormatString(), label);
- }
- return label;
- }
-
- /**
- * Get the string format for formatting the text value. This String must
- * contain a single "%s" occurrence where to place the value.
- *
- * @return the format string
- */
- protected abstract String getFormatString();
-
- /**
- * Get the unformatted registered string value which shall be displayed
- */
- private String getValueString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (getReferenceFeature().getContainerClass().isInstance(obj)) {
- Object behavior = ((EObject) obj).eGet(getReferenceFeature());
- if (behavior instanceof Behavior) {
- return ((Behavior) behavior).getName();
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (getReferenceFeature().getContainerClass().isInstance(element)) {
- semanticElementsBeingParsed.add((Element) element);
- Object behavior = element.eGet(getReferenceFeature());
- if (behavior instanceof Behavior) {
- semanticElementsBeingParsed.add((Element) behavior);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return getReferenceFeature().equals(feature) || UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-
- /**
- * Get the feature by which the property behavior is linked. This method
- * must be implemented by subclasses and the returned feature must reference
- * a Behavior.
- *
- * @return reference feature
- */
- protected abstract EStructuralFeature getReferenceFeature();
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Behavior; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying a behavior which is associated to an + * element. This parser refreshes the text displayed for the behavior. + */ +public abstract class AssociatedBehaviorParser extends MessageFormatParser implements ISemanticParser { + + public AssociatedBehaviorParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public AssociatedBehaviorParser(EAttribute[] features) { + super(features); + } + + public AssociatedBehaviorParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + @Override + public String getEditString(IAdaptable adapter, int flags) { + String value = getValueString(adapter, flags, false); + if (value != null) { + return value; + } + return ""; + } + + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object obj = adapter.getAdapter(EObject.class); + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + if (getReferenceFeature().getContainerClass().isInstance(obj)) { + Object behavior = ((EObject) obj).eGet(getReferenceFeature()); + if (behavior instanceof Behavior) { + return getModificationCommand((EObject) behavior, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + } + } + return UnexecutableCommand.INSTANCE; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String label = getValueString(element, flags, true); + if (label == null || label.length() == 0) { + label = ""; + } else { + label = String.format(getFormatString(), label); + } + return label; + } + + /** + * Get the string format for formatting the text value. This String must + * contain a single "%s" occurrence where to place the value. + * + * @return the format string + */ + protected abstract String getFormatString(); + + /** + * Get the unformatted registered string value which shall be displayed + */ + private String getValueString(final IAdaptable element, final int flags, final boolean useInternationalization) { + Object obj = element.getAdapter(EObject.class); + if (getReferenceFeature().getContainerClass().isInstance(obj)) { + Object behavior = ((EObject) obj).eGet(getReferenceFeature()); + if (behavior instanceof Behavior) { + if(useInternationalization){ + return UMLLabelInternationalization.getInstance().getLabel((Behavior)behavior); + }else{ + return ((Behavior) behavior).getName(); + } + } + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (getReferenceFeature().getContainerClass().isInstance(element)) { + semanticElementsBeingParsed.add((Element) element); + Object behavior = element.eGet(getReferenceFeature()); + if (behavior instanceof Behavior) { + semanticElementsBeingParsed.add((Element) behavior); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return getReferenceFeature().equals(feature) || UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature); + } + + /** + * Get the feature by which the property behavior is linked. This method + * must be implemented by subclasses and the returned feature must reference + * a Behavior. + * + * @return reference feature + */ + protected abstract EStructuralFeature getReferenceFeature(); +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallBehaviorActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallBehaviorActionParser.java index 165b0e223d3..7abe6c40c5a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallBehaviorActionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallBehaviorActionParser.java @@ -1,149 +1,151 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.CallBehaviorAction;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the label of a CallBehaviorAction. This
- * parser refreshes the text displayed for the CallBehaviorAction.
- */
-public class CallBehaviorActionParser extends MessageFormatParser implements ISemanticParser {
-
- /** the format for CallBehaviorAction label */
- private static final String CALLBEHAVIORACTION_LABEL_FORMAT = "%s : %s";
-
- public CallBehaviorActionParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public CallBehaviorActionParser(EAttribute[] features) {
- super(features);
- }
-
- public CallBehaviorActionParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof CallBehaviorAction) {
- CallBehaviorAction action = (CallBehaviorAction) obj;
- String actionName = "";
- if (action.getName() != null) {
- actionName = action.getName();
- }
- String behaviorName = "";
- if (action.getBehavior() != null && action.getBehavior().getName() != null) {
- behaviorName = action.getBehavior().getName();
- }
- // display behavior name alone if name is not specified differently
- if ("".equals(actionName) || actionName.equals(behaviorName)) {
- return behaviorName;
- } else {
- return String.format(CALLBEHAVIORACTION_LABEL_FORMAT, actionName, behaviorName);
- }
- }
- return " ";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof CallBehaviorAction) {
- CallBehaviorAction action = (CallBehaviorAction) element;
- semanticElementsBeingParsed.add(action);
- Behavior behavior = action.getBehavior();
- if (behavior != null) {
- semanticElementsBeingParsed.add(behavior);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getCallBehaviorAction_Behavior().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Behavior; +import org.eclipse.uml2.uml.CallBehaviorAction; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the label of a CallBehaviorAction. This + * parser refreshes the text displayed for the CallBehaviorAction. + */ +public class CallBehaviorActionParser extends MessageFormatParser implements ISemanticParser { + + /** the format for CallBehaviorAction label */ + private static final String CALLBEHAVIORACTION_LABEL_FORMAT = "%s : %s"; + + public CallBehaviorActionParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public CallBehaviorActionParser(EAttribute[] features) { + super(features); + } + + public CallBehaviorActionParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof CallBehaviorAction) { + CallBehaviorAction action = (CallBehaviorAction) obj; + String actionName = ""; + if (action.getName() != null) { + actionName = UMLLabelInternationalization.getInstance().getLabel(action); + } + String behaviorName = ""; + if (action.getBehavior() != null && action.getBehavior().getName() != null) { + behaviorName = UMLLabelInternationalization.getInstance().getLabel(action.getBehavior()); + } + // display behavior name alone if name is not specified differently + if ("".equals(actionName) || actionName.equals(behaviorName)) { + return behaviorName; + } else { + return String.format(CALLBEHAVIORACTION_LABEL_FORMAT, actionName, behaviorName); + } + } + return " "; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof CallBehaviorAction) { + CallBehaviorAction action = (CallBehaviorAction) element; + semanticElementsBeingParsed.add(action); + Behavior behavior = action.getBehavior(); + if (behavior != null) { + semanticElementsBeingParsed.add(behavior); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getCallBehaviorAction_Behavior().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java index 159c9348ecb..f303d465fb4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java @@ -1,168 +1,170 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.CallOperationAction;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the label of a CallOperationAction. This
- * parser refreshes the text displayed for the CallOperationAction.
- */
-public class CallOperationActionParser extends MessageFormatParser implements ISemanticParser {
-
- private static final UMLPackage eUML = UMLPackage.eINSTANCE;
-
- public CallOperationActionParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public CallOperationActionParser(EAttribute[] features) {
- super(features);
- }
-
- public CallOperationActionParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isAffectingFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof CallOperationAction) {
- CallOperationAction action = (CallOperationAction) obj;
- String name = action.getName();
- String operation = "";
- if (name == null) {
- name = "";
- }
- if (action.getOperation() != null) {
- operation = action.getOperation().getName();
- if (operation == null) {
- operation = "";
- }
- }
- // name, operation and className are initialized with non null
- // values
- return getPrintString(name, operation);
- }
- return " ";
- }
-
- /**
- * Get the string to print with the given elements
- *
- * @param name
- * the name of the node or ""
- * @param operation
- * the name of the operation or ""
- * @param className
- * the name of the operation class or ""
- * @return the string to print
- */
- private String getPrintString(String name, String operation) {
- return isEmpty(name) ? operation : name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isAffectingFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof CallOperationAction) {
- CallOperationAction action = (CallOperationAction) element;
- semanticElementsBeingParsed.add(action);
- Operation operation = action.getOperation();
- if (operation != null) {
- semanticElementsBeingParsed.add(operation);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isAffectingFeature(EStructuralFeature feature) {
- return eUML.getNamedElement_Name().equals(feature) || //
- eUML.getCallOperationAction_Operation().equals(feature);
- }
-
- private static boolean isEmpty(String text) {
- return text == null || text.length() == 0;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CallOperationAction; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the label of a CallOperationAction. This + * parser refreshes the text displayed for the CallOperationAction. + */ +public class CallOperationActionParser extends MessageFormatParser implements ISemanticParser { + + private static final UMLPackage eUML = UMLPackage.eINSTANCE; + + public CallOperationActionParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public CallOperationActionParser(EAttribute[] features) { + super(features); + } + + public CallOperationActionParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isAffectingFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof CallOperationAction) { + CallOperationAction action = (CallOperationAction) obj; + String name = UMLLabelInternationalization.getInstance().getLabel(action); + String operation = ""; + if (name == null) { + name = ""; + } + if (action.getOperation() != null) { + operation = UMLLabelInternationalization.getInstance().getLabel(action.getOperation()); + if (operation == null) { + operation = ""; + } + } + // name, operation and className are initialized with non null + // values + return getPrintString(name, operation); + } + return " "; + } + + /** + * Get the string to print with the given elements + * + * @param name + * the name of the node or "" + * @param operation + * the name of the operation or "" + * @param className + * the name of the operation class or "" + * @return the string to print + */ + private String getPrintString(String name, String operation) { + return isEmpty(name) ? operation : name; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isAffectingFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof CallOperationAction) { + CallOperationAction action = (CallOperationAction) element; + semanticElementsBeingParsed.add(action); + Operation operation = action.getOperation(); + if (operation != null) { + semanticElementsBeingParsed.add(operation); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isAffectingFeature(EStructuralFeature feature) { + return eUML.getNamedElement_Name().equals(feature) || // + eUML.getCallOperationAction_Operation().equals(feature); + } + + private static boolean isEmpty(String text) { + return text == null || text.length() == 0; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/EdgeGuardParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/EdgeGuardParser.java index 7e56890ea05..2626e8832d0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/EdgeGuardParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/EdgeGuardParser.java @@ -1,190 +1,191 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ActivityEdge;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for displaying the guard of an Activity Edge. This parser
- * refreshes the text displayed for the guard.
- */
-public class EdgeGuardParser extends MessageFormatParser implements ISemanticParser {
-
- /** The format string for displaying the guard */
- private static final String GUARD_FORMAT = "[%s]";
-
- public EdgeGuardParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public EdgeGuardParser(EAttribute[] features) {
- super(features);
- }
-
- public EdgeGuardParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- String value = getValueString(adapter, flags);
- if (value != null) {
- return value;
- }
- return "";
- }
-
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- if (obj instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) obj;
- ValueSpecification valueSpec = edge.getGuard();
- if (valueSpec != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString)));
- return command;
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String label = getValueString(element, flags);
- if (label == null || label.length() == 0) {
- label = " ";
- } else {
- label = String.format(GUARD_FORMAT, label);
- }
- return label;
- }
-
- /**
- * Get the unformatted registered string value which shall be displayed
- */
- private String getValueString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) obj;
- ValueSpecification valueSpec = edge.getGuard();
- if (valueSpec != null) {
- String value = ValueSpecificationUtil.getSpecificationValue(valueSpec);
- if (value != null) {
- return value;
- }
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof ActivityEdge) {
- ActivityEdge edge = (ActivityEdge) element;
- semanticElementsBeingParsed.add(edge);
- if (edge.getGuard() != null) {
- semanticElementsBeingParsed.add(edge.getGuard());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getActivityEdge_Guard().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass());
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.ActivityEdge; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * A specific parser for displaying the guard of an Activity Edge. This parser + * refreshes the text displayed for the guard. + */ +public class EdgeGuardParser extends MessageFormatParser implements ISemanticParser { + + /** The format string for displaying the guard */ + private static final String GUARD_FORMAT = "[%s]"; + + public EdgeGuardParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public EdgeGuardParser(EAttribute[] features) { + super(features); + } + + public EdgeGuardParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + @Override + public String getEditString(IAdaptable adapter, int flags) { + String value = getValueString(adapter, flags, false); + if (value != null) { + return value; + } + return ""; + } + + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object obj = adapter.getAdapter(EObject.class); + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + if (obj instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) obj; + ValueSpecification valueSpec = edge.getGuard(); + if (valueSpec != null) { + CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$ + command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString))); + return command; + } + } + return UnexecutableCommand.INSTANCE; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String label = getValueString(element, flags, true); + if (label == null || label.length() == 0) { + label = " "; + } else { + label = String.format(GUARD_FORMAT, label); + } + return label; + } + + /** + * Get the unformatted registered string value which shall be displayed + */ + private String getValueString(IAdaptable element, int flags, final boolean useInternationalizayion) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) obj; + ValueSpecification valueSpec = edge.getGuard(); + if (valueSpec != null) { + String value = ValueSpecificationUtil.getSpecificationValue(valueSpec, useInternationalizayion); + if (value != null) { + return value; + } + } + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof ActivityEdge) { + ActivityEdge edge = (ActivityEdge) element; + semanticElementsBeingParsed.add(edge); + if (edge.getGuard() != null) { + semanticElementsBeingParsed.add(edge.getGuard()); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getActivityEdge_Guard().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass()); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ExceptionHandlerTypeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ExceptionHandlerTypeParser.java index ddf0f06e821..6b0559f9bd8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ExceptionHandlerTypeParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ExceptionHandlerTypeParser.java @@ -1,145 +1,147 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExceptionHandler;
-import org.eclipse.uml2.uml.StructuredActivityNode;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the type label of an ExceptionHandler. This
- * parser refreshes the text displayed for the ExceptionHandler.
- */
-public class ExceptionHandlerTypeParser extends MessageFormatParser implements ISemanticParser {
-
- /** The line break */
- private static final String LINE_BREAK = System.getProperty("line.separator");
-
- public ExceptionHandlerTypeParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ExceptionHandlerTypeParser(EAttribute[] features) {
- super(features);
- }
-
- public ExceptionHandlerTypeParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- StringBuffer label = new StringBuffer();
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof ExceptionHandler) {
- EList<Classifier> excTypes = ((ExceptionHandler) obj).getExceptionTypes();
- for (Classifier type : excTypes) {
- if (type != null && !"".equals(type.getName()) && type.getName() != null) {
- if (label.length() > 0) {
- label.append(LINE_BREAK);
- }
- label.append(type.getName());
- }
- }
- }
- return label.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof StructuredActivityNode) {
- semanticElementsBeingParsed.add((ExceptionHandler) element);
- EList<Classifier> excTypes = ((ExceptionHandler) element).getExceptionTypes();
- for (Classifier type : excTypes) {
- semanticElementsBeingParsed.add(type);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getExceptionHandler_ExceptionType().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.ExceptionHandler; +import org.eclipse.uml2.uml.StructuredActivityNode; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the type label of an ExceptionHandler. This + * parser refreshes the text displayed for the ExceptionHandler. + */ +public class ExceptionHandlerTypeParser extends MessageFormatParser implements ISemanticParser { + + /** The line break */ + private static final String LINE_BREAK = System.getProperty("line.separator"); + + public ExceptionHandlerTypeParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public ExceptionHandlerTypeParser(EAttribute[] features) { + super(features); + } + + public ExceptionHandlerTypeParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + StringBuffer label = new StringBuffer(); + Object obj = element.getAdapter(EObject.class); + if (obj instanceof ExceptionHandler) { + EList<Classifier> excTypes = ((ExceptionHandler) obj).getExceptionTypes(); + for (Classifier type : excTypes) { + if (type != null && !"".equals(type.getName()) && type.getName() != null) { + if (label.length() > 0) { + label.append(LINE_BREAK); + } + label.append(UMLLabelInternationalization.getInstance().getLabel(type)); + } + } + } + return label.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof StructuredActivityNode) { + semanticElementsBeingParsed.add((ExceptionHandler) element); + EList<Classifier> excTypes = ((ExceptionHandler) element).getExceptionTypes(); + for (Classifier type : excTypes) { + semanticElementsBeingParsed.add(type); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getExceptionHandler_ExceptionType().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ObjectNodeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ObjectNodeParser.java index 3ba8d2cebca..1e76256f0a9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ObjectNodeParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ObjectNodeParser.java @@ -1,174 +1,176 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ObjectNode;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * The Class ObjectNodeParser. This parser handle labels for Object Nodes
- */
-public class ObjectNodeParser extends MessageFormatParser implements ISemanticParser {
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with no
- * type
- */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with its
- * type
- */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /**
- * The String format for displaying an ActivityParameterNodeParser with in
- * State property
- */
- private static final String STATE_FORMAT = System.getProperty("line.separator").concat("[%s]");
-
- /** The String for separating states */
- private static final String STATE_SEPARATOR = ", ";
-
- public ObjectNodeParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public ObjectNodeParser(EAttribute[] features) {
- super(features);
- }
-
- public ObjectNodeParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- StringBuffer result = new StringBuffer();
- Object adapter = element.getAdapter(EObject.class);
- if (adapter instanceof ObjectNode) {
- ObjectNode objectNode = (ObjectNode) adapter;
- String name = objectNode.getName();
- // manage type
- if (objectNode.getType() != null) {
- String type = objectNode.getType().getName();
- result.append(String.format(TYPED_PARAMETER_FORMAT, name, type));
- } else {
- result.append(String.format(UNTYPED_PARAMETER_FORMAT, name));
- }
- // manage states
- StringBuffer stateLabel = new StringBuffer();
- for (State state : objectNode.getInStates()) {
- String stateName = state.getName();
- if (stateName == null) {
- stateName = "";
- }
- if (!"".equals(stateName)) {
- if (stateLabel.length() > 0) {
- stateLabel.append(STATE_SEPARATOR);
- }
- stateLabel.append(stateName);
- }
- }
- if (stateLabel.length() > 0) {
- result.append(String.format(STATE_FORMAT, stateLabel.toString()));
- }
- }
- return result.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- ObjectNode objectNode = null;
- if (element instanceof ObjectNode) {
- objectNode = (ObjectNode) element;
- semanticElementsBeingParsed.add(objectNode);
- if (objectNode.getType() != null) {
- semanticElementsBeingParsed.add(objectNode.getType());
- }
- if (objectNode.getInStates() != null && !objectNode.getInStates().isEmpty()) {
- semanticElementsBeingParsed.addAll(objectNode.getInStates());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.ObjectNode; +import org.eclipse.uml2.uml.State; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * The Class ObjectNodeParser. This parser handle labels for Object Nodes + */ +public class ObjectNodeParser extends MessageFormatParser implements ISemanticParser { + + /** + * The String format for displaying an ActivityParameterNodeParser with no + * type + */ + private static final String UNTYPED_PARAMETER_FORMAT = "%s"; + + /** + * The String format for displaying an ActivityParameterNodeParser with its + * type + */ + private static final String TYPED_PARAMETER_FORMAT = "%s: %s"; + + /** + * The String format for displaying an ActivityParameterNodeParser with in + * State property + */ + private static final String STATE_FORMAT = System.getProperty("line.separator").concat("[%s]"); + + /** The String for separating states */ + private static final String STATE_SEPARATOR = ", "; + + public ObjectNodeParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + public ObjectNodeParser(EAttribute[] features) { + super(features); + } + + public ObjectNodeParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * Gets the e structural feature. + * + * @param notification + * @return the structural feature + */ + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + StringBuffer result = new StringBuffer(); + Object adapter = element.getAdapter(EObject.class); + if (adapter instanceof ObjectNode) { + ObjectNode objectNode = (ObjectNode) adapter; + String name = UMLLabelInternationalization.getInstance().getLabel(objectNode); + // manage type + if (objectNode.getType() != null) { + String type = UMLLabelInternationalization.getInstance().getLabel(objectNode.getType()); + result.append(String.format(TYPED_PARAMETER_FORMAT, name, type)); + } else { + result.append(String.format(UNTYPED_PARAMETER_FORMAT, name)); + } + // manage states + StringBuffer stateLabel = new StringBuffer(); + for (State state : objectNode.getInStates()) { + String stateName = UMLLabelInternationalization.getInstance().getLabel(state); + if (stateName == null) { + stateName = ""; + } + if (!"".equals(stateName)) { + if (stateLabel.length() > 0) { + stateLabel.append(STATE_SEPARATOR); + } + stateLabel.append(stateName); + } + } + if (stateLabel.length() > 0) { + result.append(String.format(STATE_FORMAT, stateLabel.toString())); + } + } + return result.toString(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("unchecked") + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + ObjectNode objectNode = null; + if (element instanceof ObjectNode) { + objectNode = (ObjectNode) element; + semanticElementsBeingParsed.add(objectNode); + if (objectNode.getType() != null) { + semanticElementsBeingParsed.add(objectNode.getType()); + } + if (objectNode.getInStates() != null && !objectNode.getInStates().isEmpty()) { + semanticElementsBeingParsed.addAll(objectNode.getInStates()); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ParameterParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ParameterParser.java index f40958ec85c..7825dca6af7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ParameterParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/ParameterParser.java @@ -1,149 +1,151 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying an Activity's Parameter. This parser
- * refreshes the text displayed for the Parameter.
- */
-public class ParameterParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying a parameter with its type */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /** The String format for displaying a parameter with no type */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- public ParameterParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ParameterParser(EAttribute[] features) {
- super(features);
- }
-
- public ParameterParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof Parameter) {
- Parameter parameter = (Parameter) obj;
- String name = parameter.getName();
- if (name == null) {
- name = " ";
- }
- if (parameter.getType() != null) {
- String type = parameter.getType().getName();
- if (type == null) {
- type = "";
- }
- return String.format(TYPED_PARAMETER_FORMAT, name, type);
- } else {
- return String.format(UNTYPED_PARAMETER_FORMAT, name);
- }
- }
- return " ";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Parameter) {
- Parameter parameter = (Parameter) element;
- semanticElementsBeingParsed.add(parameter);
- if (parameter.getType() != null) {
- semanticElementsBeingParsed.add(parameter.getType());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying an Activity's Parameter. This parser + * refreshes the text displayed for the Parameter. + */ +public class ParameterParser extends MessageFormatParser implements ISemanticParser { + + /** The String format for displaying a parameter with its type */ + private static final String TYPED_PARAMETER_FORMAT = "%s: %s"; + + /** The String format for displaying a parameter with no type */ + private static final String UNTYPED_PARAMETER_FORMAT = "%s"; + + public ParameterParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public ParameterParser(EAttribute[] features) { + super(features); + } + + public ParameterParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof Parameter) { + Parameter parameter = (Parameter) obj; + String name = UMLLabelInternationalization.getInstance().getLabel(parameter); + if (name == null) { + name = " "; + } + if (parameter.getType() != null) { + String type = UMLLabelInternationalization.getInstance().getLabel(parameter.getType()); + if (type == null) { + type = ""; + } + return String.format(TYPED_PARAMETER_FORMAT, name, type); + } else { + return String.format(UNTYPED_PARAMETER_FORMAT, name); + } + } + return " "; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Parameter) { + Parameter parameter = (Parameter) element; + semanticElementsBeingParsed.add(parameter); + if (parameter.getType() != null) { + semanticElementsBeingParsed.add(parameter.getType()); + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinParser.java index 07b8a2abe05..6d96e37e971 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinParser.java @@ -1,171 +1,173 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Pin;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying the label of a Pin. This parser refreshes
- * the text displayed for the Pin.
- */
-public class PinParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying in State property */
- private static final String STATE_DISPLAY = System.getProperty("line.separator").concat("[%s]");
-
- /** The String for separating states */
- private static final String STATE_SEPARATOR = ", ";
-
- public PinParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public PinParser(EAttribute[] features) {
- super(features);
- }
-
- public PinParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- StringBuffer label = new StringBuffer();
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof Pin) {
- Pin pin = (Pin) obj;
- String name = pin.getName();
- if (name == null) {
- name = "";
- }
- label.append(name);
- if (pin.getInStates() != null) {
- // manage states
- StringBuffer stateLabel = new StringBuffer();
- for (State state : pin.getInStates()) {
- if (state != null) {
- String stateName = state.getName();
- if (stateName == null) {
- stateName = "";
- }
- if (!"".equals(stateName)) {
- if (stateLabel.length() > 0) {
- stateLabel.append(STATE_SEPARATOR);
- }
- stateLabel.append(stateName);
- }
- }
- }
- if (stateLabel.length() > 0) {
- label.append(String.format(STATE_DISPLAY, stateLabel.toString()));
- }
- }
- }
- if (label.length() == 0) {
- label.append(" ");
- }
- return label.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Pin) {
- Pin pin = (Pin) element;
- semanticElementsBeingParsed.add(pin);
- if (pin.getInStates() != null) {
- for (State state : pin.getInStates()) {
- if (state != null) {
- semanticElementsBeingParsed.add(state);
- }
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Pin; +import org.eclipse.uml2.uml.State; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for displaying the label of a Pin. This parser refreshes + * the text displayed for the Pin. + */ +public class PinParser extends MessageFormatParser implements ISemanticParser { + + /** The String format for displaying in State property */ + private static final String STATE_DISPLAY = System.getProperty("line.separator").concat("[%s]"); + + /** The String for separating states */ + private static final String STATE_SEPARATOR = ", "; + + public PinParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public PinParser(EAttribute[] features) { + super(features); + } + + public PinParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + StringBuffer label = new StringBuffer(); + Object obj = element.getAdapter(EObject.class); + if (obj instanceof Pin) { + Pin pin = (Pin) obj; + String name = UMLLabelInternationalization.getInstance().getLabel(pin); + if (name == null) { + name = ""; + } + label.append(name); + if (pin.getInStates() != null) { + // manage states + StringBuffer stateLabel = new StringBuffer(); + for (State state : pin.getInStates()) { + if (state != null) { + String stateName = UMLLabelInternationalization.getInstance().getLabel(state); + if (stateName == null) { + stateName = ""; + } + if (!"".equals(stateName)) { + if (stateLabel.length() > 0) { + stateLabel.append(STATE_SEPARATOR); + } + stateLabel.append(stateName); + } + } + } + if (stateLabel.length() > 0) { + label.append(String.format(STATE_DISPLAY, stateLabel.toString())); + } + } + } + if (label.length() == 0) { + label.append(" "); + } + return label.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Pin) { + Pin pin = (Pin) element; + semanticElementsBeingParsed.add(pin); + if (pin.getInStates() != null) { + for (State state : pin.getInStates()) { + if (state != null) { + semanticElementsBeingParsed.add(state); + } + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getObjectNode_InState().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinValueParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinValueParser.java index 2a97593d358..203bce96dd2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinValueParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PinValueParser.java @@ -1,247 +1,249 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Action;
-import org.eclipse.uml2.uml.ActionInputPin;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Pin;
-import org.eclipse.uml2.uml.ReadSelfAction;
-import org.eclipse.uml2.uml.ReadVariableAction;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValuePin;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.ValueSpecificationAction;
-import org.eclipse.uml2.uml.Variable;
-
-/**
- * A specific parser for displaying the label of a Pin. This parser refreshes
- * the text displayed for the Pin.
- */
-public class PinValueParser extends MessageFormatParser implements ISemanticParser {
-
- /** The keyword for indication a ReadSelfAction input pin */
- private static final String SELF_KEYWORD = "self";
-
- public PinValueParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public PinValueParser(EAttribute[] features) {
- super(features);
- }
-
- public PinValueParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
- * (java.lang.Object , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- return getPrintString(adapter, flags);
- }
-
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- if (obj instanceof ValuePin) {
- ValuePin pin = (ValuePin) obj;
- ValueSpecification valueSpec = pin.getValue();
- if (valueSpec != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString)));
- return command;
- }
- } else if (obj instanceof ActionInputPin) {
- ActionInputPin pin = (ActionInputPin) obj;
- Action action = pin.getFromAction();
- if (action instanceof ReadVariableAction) {
- Variable variable = ((ReadVariableAction) action).getVariable();
- if (variable != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- command.compose(getModificationCommand(variable, UMLPackage.eINSTANCE.getNamedElement_Name(), newString));
- return command;
- }
- } else if (action instanceof ReadSelfAction) {
- return UnexecutableCommand.INSTANCE;
- } else if (action instanceof ValueSpecificationAction) {
- ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue();
- if (valueSpec != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString)));
- return command;
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
- * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- // ensure valueLabel is never null
- String valueLabel = " ";
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof ValuePin) {
- ValuePin pin = (ValuePin) obj;
- ValueSpecification valueSpec = pin.getValue();
- if (valueSpec != null) {
- String value = ValueSpecificationUtil.getSpecificationValue(valueSpec);
- if (value != null) {
- valueLabel = value;
- }
- }
- } else if (obj instanceof ActionInputPin) {
- ActionInputPin pin = (ActionInputPin) obj;
- Action action = pin.getFromAction();
- if (action instanceof ReadVariableAction) {
- Variable variable = ((ReadVariableAction) action).getVariable();
- if (variable != null) {
- String value = variable.getName();
- if (value != null) {
- valueLabel = value;
- }
- }
- } else if (action instanceof ReadSelfAction) {
- valueLabel = SELF_KEYWORD;
- } else if (action instanceof ValueSpecificationAction) {
- ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue();
- if (valueSpec != null) {
- String value = ValueSpecificationUtil.getSpecificationValue(valueSpec);
- if (value != null) {
- valueLabel = value;
- }
- }
- }
- }
- if (valueLabel.length() == 0) {
- valueLabel = " ";
- }
- return valueLabel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Pin) {
- Pin pin = (Pin) element;
- semanticElementsBeingParsed.add(pin);
- if (pin instanceof ValuePin) {
- ValueSpecification valueSpec = ((ValuePin) pin).getValue();
- if (valueSpec != null) {
- semanticElementsBeingParsed.add(valueSpec);
- }
- } else if (pin instanceof ActionInputPin) {
- Action action = ((ActionInputPin) pin).getFromAction();
- if (action != null) {
- semanticElementsBeingParsed.add(action);
- }
- if (action instanceof ReadVariableAction) {
- Variable variable = ((ReadVariableAction) action).getVariable();
- if (variable != null) {
- semanticElementsBeingParsed.add(variable);
- }
- } else if (action instanceof ValueSpecificationAction) {
- ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue();
- if (valueSpec != null) {
- semanticElementsBeingParsed.add(valueSpec);
- }
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getValuePin_Value().equals(feature) || UMLPackage.eINSTANCE.getActionInputPin_FromAction().equals(feature)
- || UMLPackage.eINSTANCE.getVariableAction_Variable().equals(feature) || UMLPackage.eINSTANCE.getValueSpecificationAction_Value().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass());
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.activity.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Action; +import org.eclipse.uml2.uml.ActionInputPin; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Pin; +import org.eclipse.uml2.uml.ReadSelfAction; +import org.eclipse.uml2.uml.ReadVariableAction; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValuePin; +import org.eclipse.uml2.uml.ValueSpecification; +import org.eclipse.uml2.uml.ValueSpecificationAction; +import org.eclipse.uml2.uml.Variable; + +/** + * A specific parser for displaying the label of a Pin. This parser refreshes + * the text displayed for the Pin. + */ +public class PinValueParser extends MessageFormatParser implements ISemanticParser { + + /** The keyword for indication a ReadSelfAction input pin */ + private static final String SELF_KEYWORD = "self"; + + public PinValueParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public PinValueParser(EAttribute[] features) { + super(features); + } + + public PinValueParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent + * (java.lang.Object , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + @Override + public String getEditString(IAdaptable adapter, int flags) { + return getPrintString(adapter, flags); + } + + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object obj = adapter.getAdapter(EObject.class); + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + if (obj instanceof ValuePin) { + ValuePin pin = (ValuePin) obj; + ValueSpecification valueSpec = pin.getValue(); + if (valueSpec != null) { + CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$ + command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString))); + return command; + } + } else if (obj instanceof ActionInputPin) { + ActionInputPin pin = (ActionInputPin) obj; + Action action = pin.getFromAction(); + if (action instanceof ReadVariableAction) { + Variable variable = ((ReadVariableAction) action).getVariable(); + if (variable != null) { + CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$ + command.compose(getModificationCommand(variable, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + return command; + } + } else if (action instanceof ReadSelfAction) { + return UnexecutableCommand.INSTANCE; + } else if (action instanceof ValueSpecificationAction) { + ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue(); + if (valueSpec != null) { + CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$ + command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString))); + return command; + } + } + } + return UnexecutableCommand.INSTANCE; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser# + * getPrintString(org.eclipse .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + // ensure valueLabel is never null + String valueLabel = " "; + Object obj = element.getAdapter(EObject.class); + if (obj instanceof ValuePin) { + ValuePin pin = (ValuePin) obj; + ValueSpecification valueSpec = pin.getValue(); + if (valueSpec != null) { + String value = ValueSpecificationUtil.getSpecificationValue(valueSpec, true); + if (value != null) { + valueLabel = value; + } + } + } else if (obj instanceof ActionInputPin) { + ActionInputPin pin = (ActionInputPin) obj; + Action action = pin.getFromAction(); + if (action instanceof ReadVariableAction) { + Variable variable = ((ReadVariableAction) action).getVariable(); + if (variable != null) { + String value = UMLLabelInternationalization.getInstance().getLabel(variable); + if (value != null) { + valueLabel = value; + } + } + } else if (action instanceof ReadSelfAction) { + valueLabel = SELF_KEYWORD; + } else if (action instanceof ValueSpecificationAction) { + ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue(); + if (valueSpec != null) { + String value = ValueSpecificationUtil.getSpecificationValue(valueSpec); + if (value != null) { + valueLabel = value; + } + } + } + } + if (valueLabel.length() == 0) { + valueLabel = " "; + } + return valueLabel; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @Override + public List<?> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Pin) { + Pin pin = (Pin) element; + semanticElementsBeingParsed.add(pin); + if (pin instanceof ValuePin) { + ValueSpecification valueSpec = ((ValuePin) pin).getValue(); + if (valueSpec != null) { + semanticElementsBeingParsed.add(valueSpec); + } + } else if (pin instanceof ActionInputPin) { + Action action = ((ActionInputPin) pin).getFromAction(); + if (action != null) { + semanticElementsBeingParsed.add(action); + } + if (action instanceof ReadVariableAction) { + Variable variable = ((ReadVariableAction) action).getVariable(); + if (variable != null) { + semanticElementsBeingParsed.add(variable); + } + } else if (action instanceof ValueSpecificationAction) { + ValueSpecification valueSpec = ((ValueSpecificationAction) action).getValue(); + if (valueSpec != null) { + semanticElementsBeingParsed.add(valueSpec); + } + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getValuePin_Value().equals(feature) || UMLPackage.eINSTANCE.getActionInputPin_FromAction().equals(feature) + || UMLPackage.eINSTANCE.getVariableAction_Variable().equals(feature) || UMLPackage.eINSTANCE.getValueSpecificationAction_Value().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass()); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PostConditionConstraintLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PostConditionConstraintLabelParser.java index 0e78513fd0b..5e9a898c5ad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PostConditionConstraintLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PostConditionConstraintLabelParser.java @@ -1,145 +1,157 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Specific Parser for the comment, in case they have a html format.
- */
-public class PostConditionConstraintLabelParser implements IParser {
-
- private static final String CHEVRON = String.valueOf("\u00AB") + "PostCondition" + String.valueOf("\u00BB");
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public List getSemanticElementsBeingParsed(EObject element) {
- List list = new ArrayList();
- list.add(element);
- return list;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable element, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return "<NULL CONSTRAINT>"; //$NON-NLS-1$
- }
- return constraint.getName();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return UnexecutableCommand.INSTANCE;
- }
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Name"); //$NON-NLS-1$
- SetRequest request = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
- command.compose(new SetValueCommand(request));
- return command;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return "<NULL CONSTRAINT>"; //$NON-NLS-1$
- }
- return CHEVRON + constraint.getName();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- if (event instanceof org.eclipse.emf.common.notify.Notification) {
- Object source = ((org.eclipse.emf.common.notify.Notification) event).getFeature();
- if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(source)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- /**
- * Get the property associated with the given IAdaptable and the
- * memberEndIndex .
- *
- * @param element
- * the given IAdaptable
- * @return the property associated or null if it can't be found.
- */
- protected Constraint doAdapt(IAdaptable element) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof Constraint) {
- return (Constraint) obj;
- }
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Specific Parser for the comment, in case they have a html format. + */ +public class PostConditionConstraintLabelParser implements IParser { + + private static final String CHEVRON = String.valueOf("\u00AB") + "PostCondition" + String.valueOf("\u00BB"); + + /** + * {@inheritDoc} + */ + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + return false; + } + + /** + * {@inheritDoc} + */ + public List getSemanticElementsBeingParsed(EObject element) { + List list = new ArrayList(); + list.add(element); + return list; + } + + /** + * {@inheritDoc} + */ + @Override + public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String getEditString(IAdaptable element, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return "<NULL CONSTRAINT>"; //$NON-NLS-1$ + } + return UMLLabelInternationalization.getInstance().getLabel(constraint); + } + + /** + * {@inheritDoc} + */ + @Override + public ICommand getParseCommand(IAdaptable element, String newString, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return UnexecutableCommand.INSTANCE; + } + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + + ICommand command = null; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(constraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(constraint)) { + final ModelSet modelSet = (ModelSet) constraint.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), constraint, newString, null)); + } else { + command = new CompositeTransactionalCommand(editingDomain, "Set Name"); //$NON-NLS-1$ + SetRequest request = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + command.compose(new SetValueCommand(request)); + } + return command; + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return "<NULL CONSTRAINT>"; //$NON-NLS-1$ + } + return CHEVRON + UMLLabelInternationalization.getInstance().getLabel(constraint); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + if (event instanceof org.eclipse.emf.common.notify.Notification) { + Object source = ((org.eclipse.emf.common.notify.Notification) event).getFeature(); + if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(source)) { + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable element, String editString) { + return ParserEditStatus.EDITABLE_STATUS; + } + + /** + * Get the property associated with the given IAdaptable and the + * memberEndIndex . + * + * @param element + * the given IAdaptable + * @return the property associated or null if it can't be found. + */ + protected Constraint doAdapt(IAdaptable element) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof Constraint) { + return (Constraint) obj; + } + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PreConditionConstraintLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PreConditionConstraintLabelParser.java index 4dec17afced..ed62ad9e95e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PreConditionConstraintLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/PreConditionConstraintLabelParser.java @@ -1,145 +1,157 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Specific Parser for the comment, in case they have a html format.
- */
-public class PreConditionConstraintLabelParser implements IParser {
-
- private static final String CHEVRON = String.valueOf("\u00AB") + "PreCondition" + String.valueOf("\u00BB");
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public List getSemanticElementsBeingParsed(EObject element) {
- List list = new ArrayList();
- list.add(element);
- return list;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable element, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return "<NULL CONSTRAINT>"; //$NON-NLS-1$
- }
- return constraint.getName();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return UnexecutableCommand.INSTANCE;
- }
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Name"); //$NON-NLS-1$
- SetRequest request = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
- command.compose(new SetValueCommand(request));
- return command;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Constraint constraint = doAdapt(element);
- if (constraint == null) {
- return "<NULL CONSTRAINT>"; //$NON-NLS-1$
- }
- return CHEVRON + constraint.getName();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- if (event instanceof org.eclipse.emf.common.notify.Notification) {
- Object source = ((org.eclipse.emf.common.notify.Notification) event).getFeature();
- if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(source)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- /**
- * Get the property associated with the given IAdaptable and the
- * memberEndIndex .
- *
- * @param element
- * the given IAdaptable
- * @return the property associated or null if it can't be found.
- */
- protected Constraint doAdapt(IAdaptable element) {
- Object obj = element.getAdapter(EObject.class);
- if (obj instanceof Constraint) {
- return (Constraint) obj;
- }
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Specific Parser for the comment, in case they have a html format. + */ +public class PreConditionConstraintLabelParser implements IParser { + + private static final String CHEVRON = String.valueOf("\u00AB") + "PreCondition" + String.valueOf("\u00BB"); + + /** + * {@inheritDoc} + */ + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + return false; + } + + /** + * {@inheritDoc} + */ + public List getSemanticElementsBeingParsed(EObject element) { + List list = new ArrayList(); + list.add(element); + return list; + } + + /** + * {@inheritDoc} + */ + @Override + public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String getEditString(IAdaptable element, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return "<NULL CONSTRAINT>"; //$NON-NLS-1$ + } + return UMLLabelInternationalization.getInstance().getLabel(constraint); + } + + /** + * {@inheritDoc} + */ + @Override + public ICommand getParseCommand(IAdaptable element, String newString, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return UnexecutableCommand.INSTANCE; + } + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + + ICommand command = null; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(constraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(constraint)) { + final ModelSet modelSet = (ModelSet) constraint.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), constraint, newString, null)); + } else { + command = new CompositeTransactionalCommand(editingDomain, "Set Name"); //$NON-NLS-1$ + SetRequest request = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + command.compose(new SetValueCommand(request)); + } + return command; + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Constraint constraint = doAdapt(element); + if (constraint == null) { + return "<NULL CONSTRAINT>"; //$NON-NLS-1$ + } + return CHEVRON + UMLLabelInternationalization.getInstance().getLabel(constraint); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + if (event instanceof org.eclipse.emf.common.notify.Notification) { + Object source = ((org.eclipse.emf.common.notify.Notification) event).getFeature(); + if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(source)) { + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable element, String editString) { + return ParserEditStatus.EDITABLE_STATUS; + } + + /** + * Get the property associated with the given IAdaptable and the + * memberEndIndex . + * + * @param element + * the given IAdaptable + * @return the property associated or null if it can't be found. + */ + protected Constraint doAdapt(IAdaptable element) { + Object obj = element.getAdapter(EObject.class); + if (obj instanceof Constraint) { + return (Constraint) obj; + } + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/parsers/MessageFormatParser.java index 66a33a6a206..15a81a91a6c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/parsers/MessageFormatParser.java @@ -9,6 +9,7 @@ * * Contributors: * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.activity.parsers; @@ -20,13 +21,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -210,4 +218,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF index eff3cedd6f5..bc466a74659 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF @@ -45,7 +45,9 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili org.apache.batik.svggen;bundle-version="[1.6.0,1.7.0)", org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)", org.apache.batik.css;bundle-version="[1.6.0,1.7.0)", - org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/UmlClassDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/UmlClassDiagramForMultiEditor.java index 46adaf3c209..a0c40a3bce2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/UmlClassDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/UmlClassDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * Contributors: * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz; @@ -23,6 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -70,7 +72,7 @@ public class UmlClassDiagramForMultiEditor extends org.eclipse.papyrus.uml.diagr @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java index 72844000775..4d7356b71bc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java @@ -1,103 +1,105 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Fadoi LAKHAL Fadoi.Lakhal@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz.custom.command;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * The Class DefferedAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
- * display
- *
- * @deprecated The Display of stereotype is now treated with notation View (Bug 455311)
- * use the command into oep.uml.diagram.common.stereotype.display.command instead
- *
- */
-@Deprecated
-public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
-
- /** The qualified namedepht. */
- private String stereotypeList;
-
- /**
- * the presentation kind of applied stereotypes
- */
- private String appliedStereotypePresentationKind;
-
- private IAdaptable adapter;
-
- /**
- * Instantiates a new sets the applied stereotype to display command.
- *
- * @param domain
- * the domain
- * @param object
- * the object
- * @param stereotypeList
- * the stereotype list
- */
- public DefferedAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, IAdaptable adapter, String stereotypeList, String appliedStereotypepresentationKind) {
- super(domain, null, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
- this.adapter = adapter;
- this.stereotypeList = stereotypeList;
- this.appliedStereotypePresentationKind = appliedStereotypepresentationKind;
- }
-
- @Override
- public boolean canUndo() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void doExecute() {
- View view = adapter.getAdapter(View.class);
- EObject view_element = view.getElement();
- Element element = (Element) view_element;
- Iterator<?> listStereotype = element.getAppliedStereotypes().iterator();
- while (listStereotype.hasNext()) {
- Stereotype stereotypec = (Stereotype) listStereotype.next();
- String stereotype_string = stereotypec.getName();
- stereotypeList = stereotypeList + stereotype_string;
- }
- String stereoList = AppliedStereotypeHelper.getStereotypesToDisplay(view);
- if (!"".equals(stereoList)) {
- stereoList = stereoList + ",";
- }
- stereoList = stereoList + stereotypeList;
- EAnnotation oldAnnotation = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
- if (oldAnnotation == null) {
- oldAnnotation = createEAnnotation();
- attachEannotation(oldAnnotation, view);
- }
- replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper.getStereotypesQNToDisplay(view));
- replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, stereoList);
- replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND, appliedStereotypePresentationKind);
- replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY, AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(view));
- replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION, AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(view));
- replaceEannotation(view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION), view);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fadoi LAKHAL Fadoi.Lakhal@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.clazz.custom.command; + +import java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand; +import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper; +import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Stereotype; + +/** + * The Class DefferedAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to + * display + * + * @deprecated The Display of stereotype is now treated with notation View (Bug 455311) + * use the command into oep.uml.diagram.common.stereotype.display.command instead + * + */ +@Deprecated +public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand { + + /** The qualified namedepht. */ + private String stereotypeList; + + /** + * the presentation kind of applied stereotypes + */ + private String appliedStereotypePresentationKind; + + private IAdaptable adapter; + + /** + * Instantiates a new sets the applied stereotype to display command. + * + * @param domain + * the domain + * @param object + * the object + * @param stereotypeList + * the stereotype list + */ + public DefferedAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, IAdaptable adapter, String stereotypeList, String appliedStereotypepresentationKind) { + super(domain, null, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION); + this.adapter = adapter; + this.stereotypeList = stereotypeList; + this.appliedStereotypePresentationKind = appliedStereotypepresentationKind; + } + + @Override + public boolean canUndo() { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + protected void doExecute() { + View view = adapter.getAdapter(View.class); + EObject view_element = view.getElement(); + Element element = (Element) view_element; + Iterator<?> listStereotype = element.getAppliedStereotypes().iterator(); + while (listStereotype.hasNext()) { + Stereotype stereotypec = (Stereotype) listStereotype.next(); + String stereotype_string = UMLLabelInternationalization.getInstance().getKeyword(stereotypec); + stereotypeList = stereotypeList + stereotype_string; + } + String stereoList = AppliedStereotypeHelper.getStereotypesToDisplay(view); + if (!"".equals(stereoList)) { + stereoList = stereoList + ","; + } + stereoList = stereoList + stereotypeList; + EAnnotation oldAnnotation = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION); + if (oldAnnotation == null) { + oldAnnotation = createEAnnotation(); + attachEannotation(oldAnnotation, view); + } + replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper.getStereotypesQNToDisplay(view)); + replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, stereoList); + replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND, appliedStereotypePresentationKind); + replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY, AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(view)); + replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION, AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(view)); + replaceEannotation(view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION), view); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java index 304b6984497..5e3b37b2858 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.command; @@ -21,7 +22,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.clazz.providers.ElementInitializers; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Association; import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.Type; @@ -57,6 +60,9 @@ public class PropertyCommandForAssociation extends CreateElementCommand { ElementInitializers.getInstance().init_Property_SignalAttributeLabel(newElement); if (type != null && type instanceof Type) { newElement.setName(((Type) type).getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference((Type) type) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((Type) type)) { + UMLLabelInternationalization.getInstance().setLabel((Type) type, UMLLabelInternationalization.getInstance().getLabelWithoutUML((Type) type), null); + } } return newElement; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/NestedStereotypeLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/NestedStereotypeLabelHelper.java index 92ea0161a85..cd60b7646fa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/NestedStereotypeLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/NestedStereotypeLabelHelper.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.helper; @@ -16,6 +17,7 @@ import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.NamedElement; /** @@ -44,7 +46,7 @@ public class NestedStereotypeLabelHelper extends StereotypedElementLabelHelper { @Override protected String elementLabel(GraphicalEditPart editPart) { NamedElement namedElement = getUMLElement(editPart); - return namedElement == null ? "" : namedElement.getName(); + return namedElement == null ? "" : UMLLabelInternationalization.getInstance().getLabel(namedElement); } /** @@ -60,4 +62,4 @@ public class NestedStereotypeLabelHelper extends StereotypedElementLabelHelper { } return null; } -} +}
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/ClassifierTemplateParameterParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/ClassifierTemplateParameterParser.java index d9f75e3ef91..27d4b4e276a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/ClassifierTemplateParameterParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/ClassifierTemplateParameterParser.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -20,6 +21,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.ClassifierTemplateParameter; import org.eclipse.uml2.uml.TemplateParameter; @@ -52,13 +54,13 @@ public class ClassifierTemplateParameterParser implements IParser { String out = ""; if (templateParam.getOwnedParameteredElement() instanceof Classifier) { Classifier namedElement = (Classifier) templateParam.getOwnedParameteredElement(); - out = out + namedElement.getName() + ": " + namedElement.eClass().getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(namedElement) + ": " + namedElement.eClass().getName(); } if (templateParam instanceof ClassifierTemplateParameter) { if (!((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().isEmpty()) { out = out + ">"; for (int i = 0; i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size(); i++) { - out = out + ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i).getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i)); if (i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size() - 1) { out = out + ", "; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/OperationParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/OperationParser.java index 238c56feb40..2ff8ddf6596 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/OperationParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/OperationParser.java @@ -10,6 +10,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -31,7 +32,9 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Operation; /** @@ -59,7 +62,7 @@ public class OperationParser implements IParser { EObject e = element.getAdapter(EObject.class); if (e != null) { final Operation operation = (Operation) e; - return operation.getName(); + return UMLLabelInternationalization.getInstance().getLabel(operation); } return ""; } @@ -90,7 +93,11 @@ public class OperationParser implements IParser { @Override protected void doExecute() { - operation.setName(result); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(operation) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(operation)) { + UMLLabelInternationalization.getInstance().setLabel(operation, result, null); + }else{ + operation.setName(result); + } } }; getEditingDomain().getCommandStack().execute(rc); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java index 9537a1f518d..e3d4e6551b8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java @@ -10,6 +10,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -33,7 +34,9 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Property; /** @@ -62,7 +65,7 @@ public class PropertyParser implements IParser { EObject e = element.getAdapter(EObject.class); if (e != null) { final Property property = (Property) e; - return property.getName(); + return UMLLabelInternationalization.getInstance().getLabel(property); } return ""; } @@ -94,7 +97,11 @@ public class PropertyParser implements IParser { @Override protected void doExecute() { - property.setName(result); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(property) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(property)) { + UMLLabelInternationalization.getInstance().setLabel(property, result, null); + }else{ + property.setName(result); + } } }; getEditingDomain().getCommandStack().execute(rc); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java index 5f63299c4fd..dbbf495960f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java @@ -10,6 +10,8 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -19,6 +21,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.InstanceSpecification; /** @@ -69,6 +72,6 @@ public class RoleInstanceSpecificationLinkParser implements IParser { private String getNamedNodeType(IAdaptable element) { InstanceSpecification instanceSpecification = (InstanceSpecification) element.getAdapter(EObject.class); - return instanceSpecification.getName(); + return UMLLabelInternationalization.getInstance().getLabel(instanceSpecification); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/SlotParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/SlotParser.java index 9a5bad1ac41..d1ca3ff78c1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/SlotParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/SlotParser.java @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -25,6 +26,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.InstanceValue; import org.eclipse.uml2.uml.Slot; import org.eclipse.uml2.uml.StructuralFeature; @@ -92,9 +94,9 @@ public class SlotParser implements IParser { return "<UNDEFINED>"; } StructuralFeature feature = slot.getDefiningFeature(); - String result = slot.getDefiningFeature().getName(); + String result = UMLLabelInternationalization.getInstance().getLabel(slot.getDefiningFeature()); if (feature.getType() != null) { - result += " : " + feature.getType().getName(); + result += " : " + UMLLabelInternationalization.getInstance().getLabel(feature.getType()); } if (slot.getValues().isEmpty()) { return result; @@ -104,7 +106,7 @@ public class SlotParser implements IParser { while (iter.hasNext()) { ValueSpecification currentSpecification = iter.next(); if (currentSpecification instanceof InstanceValue && ((InstanceValue) currentSpecification).getInstance() != null) { - result = result + ((InstanceValue) currentSpecification).getInstance().getName() + ", "; + result = result + UMLLabelInternationalization.getInstance().getLabel(((InstanceValue) currentSpecification).getInstance()) + ", "; } else { result = result + currentSpecification.stringValue() + ", "; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateBindingParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateBindingParser.java index dd5d0725b79..d56c4bdbd75 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateBindingParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateBindingParser.java @@ -9,6 +9,8 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * */ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -25,6 +27,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.TemplateBinding; import org.eclipse.uml2.uml.TemplateParameterSubstitution; @@ -82,10 +85,10 @@ public class TemplateBindingParser implements IParser { while (bindIter.hasNext()) { TemplateParameterSubstitution substitution = bindIter.next(); if (substitution.getFormal() != null && substitution.getFormal().getParameteredElement() instanceof NamedElement) { - out = out + ((NamedElement) substitution.getFormal().getParameteredElement()).getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) substitution.getFormal().getParameteredElement())); } if (substitution.getActual() instanceof NamedElement) { - out = out + " -> " + ((NamedElement) substitution.getActual()).getName() + "\n"; + out = out + " -> " + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) substitution.getActual())) + "\n"; } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateParameterParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateParameterParser.java index 24034a02b47..c244e0e649d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateParameterParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/TemplateParameterParser.java @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers; @@ -25,6 +26,10 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.ClassifierTemplateParameter; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Operation; @@ -68,8 +73,13 @@ public class TemplateParameterParser implements IParser { if (templateParam.getParameteredElement() instanceof NamedElement) { NamedElement namedElement = (NamedElement) templateParam.getParameteredElement(); String name = newString.substring(0, newString.indexOf(":")); - SetRequest request = new SetRequest(namedElement, UMLPackage.eINSTANCE.getNamedElement_Name(), name.trim()); - command = new SetValueCommand(request); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(namedElement) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(namedElement)){ + final ModelSet modelSet = (ModelSet)namedElement.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), namedElement, name.trim(), null)); + }else{ + SetRequest request = new SetRequest(namedElement, UMLPackage.eINSTANCE.getNamedElement_Name(), name.trim()); + command = new SetValueCommand(request); + } } } return command; @@ -86,7 +96,7 @@ public class TemplateParameterParser implements IParser { String out = ""; if (templateParam.getParameteredElement() instanceof NamedElement) { NamedElement namedElement = (NamedElement) templateParam.getParameteredElement(); - out = namedElement.getName() + ": " + namedElement.eClass().getName(); + out = UMLLabelInternationalization.getInstance().getLabel(namedElement) + ": " + namedElement.eClass().getName(); } if (templateParam instanceof OperationTemplateParameter) { if (templateParam.getParameteredElement() != null) { @@ -97,7 +107,7 @@ public class TemplateParameterParser implements IParser { if (!((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().isEmpty()) { out = out + ">"; for (int i = 0; i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size(); i++) { - out = out + ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i).getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i)); if (i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size() - 1) { out = out + ", "; } @@ -107,7 +117,7 @@ public class TemplateParameterParser implements IParser { if (templateParam.getDefault() instanceof Operation) { out = out + "=" + displayOperation((Operation) templateParam.getDefault()); } else if (templateParam.getDefault() instanceof NamedElement) { - out = out + "=" + ((NamedElement) templateParam.getDefault()).getName(); + out = out + "=" + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) templateParam.getDefault())); } return out; } @@ -115,11 +125,11 @@ public class TemplateParameterParser implements IParser { } protected String displayOperation(Operation op) { - String out = op.getName() + "("; + String out = UMLLabelInternationalization.getInstance().getLabel(op) + "("; Iterator<Parameter> iter = op.getOwnedParameters().iterator(); while (iter.hasNext()) { Parameter param = iter.next(); - out = out + param.getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(param); if (!param.equals(op.getOwnedParameters().get(op.getOwnedParameters().size() - 1))) { out = out + ", "; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InformationFlowCustomLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InformationFlowCustomLabelEditPolicy.java index 0dc616a06c2..8e5cfb75638 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InformationFlowCustomLabelEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InformationFlowCustomLabelEditPolicy.java @@ -9,6 +9,8 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.policies; @@ -16,6 +18,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.InformationFlowConveyedLabelEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.InformationFlow; @@ -124,7 +127,7 @@ public class InformationFlowCustomLabelEditPolicy extends AbstractCustomLabelEdi if (getUMLElement() instanceof InformationFlow) { EList<Classifier> classes = ((InformationFlow) getUMLElement()).getConveyeds(); for (int i = 0; i < classes.size(); i++) { - name += classes.get(i).getName(); + name += UMLLabelInternationalization.getInstance().getLabel(classes.get(i)); if (i != classes.size() - 1) { name += ", "; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java index cc7cdcca308..4603c5a9b7b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java @@ -11,6 +11,8 @@ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954 * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Patch #44973 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.clazz.custom.policies; @@ -29,6 +31,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Association; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.InstanceSpecification; @@ -191,7 +194,7 @@ public abstract class InstanceSpecificationRoleDisplayEditPolicy extends Graphic protected void refreshDisplay() { if (hostSemanticElement != null) { if (getInterestingProperty() != null) { - ((ITextAwareEditPart) getHost()).setLabelText(getInterestingProperty().getName()); + ((ITextAwareEditPart) getHost()).setLabelText(UMLLabelInternationalization.getInstance().getLabel(getInterestingProperty())); } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/parsers/MessageFormatParser.java index d4d0ba9e5e4..6a53bda1693 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src-gen/org/eclipse/papyrus/uml/diagram/clazz/parsers/MessageFormatParser.java @@ -1,205 +1,253 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.clazz.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.clazz.part.Messages;
-import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(
- UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE,
- NLS.bind(
- Messages.MessageFormatParser_InvalidInputError,
- new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + */ +package org.eclipse.papyrus.uml.diagram.clazz.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.clazz.part.Messages; +import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * @generated + */ + public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus( + UMLDiagramEditorPlugin.ID, + IParserEditStatus.UNEDITABLE, + NLS.bind( + Messages.MessageFormatParser_InvalidInputError, + new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/META-INF/MANIFEST.MF index 2919258f3be..219c58b6c81 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Export-Package: org.eclipse.papyrus.uml.diagram.common.groups.commands, Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, - org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)" + org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)", + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/core/ui/utils/CreatorUtils.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/core/ui/utils/CreatorUtils.java index ef6f0a22018..bc599aa3194 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/core/ui/utils/CreatorUtils.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/core/ui/utils/CreatorUtils.java @@ -1,121 +1,122 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.groups.core.ui.utils;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
-
-/**
- * Provides usefull utility methods for ICompositeCreator instances
- *
- * @author vhemery
- */
-public class CreatorUtils {
-
- /** The offset to use for form data */
- private static final int OFFSET = 5;
-
- /** The adapter factory to use as label provider */
- private static AdapterFactoryLabelProvider adapterFactory = null;
-
- /**
- * Get the form layout data to place element at top of the parent composite
- *
- * @return form data
- */
- public static FormData getTopFormData() {
- FormData data = new FormData();
- data.right = new FormAttachment(100, -OFFSET);
- data.left = new FormAttachment(0, OFFSET);
- data.top = new FormAttachment(0, OFFSET);
- return data;
- }
-
- /**
- * Get the form layout data to place element under another
- *
- * @param upperControl
- * control under which the element must be located
- * @return form data
- */
- public static FormData getFormDataUnder(Control upperControl) {
- FormData data = new FormData();
- data.right = new FormAttachment(100, -OFFSET);
- data.left = new FormAttachment(0, OFFSET);
- data.top = new FormAttachment(upperControl, OFFSET);
- return data;
- }
-
- /**
- * Get the form layout data to place element under another, aligned on the right of the parent composite
- *
- * @param upperControl
- * control under which the element must be located
- * @return form data
- */
- public static FormData getFormDataRightAlignedUnder(Control upperControl) {
- FormData data = new FormData();
- data.right = new FormAttachment(100, -OFFSET);
- data.top = new FormAttachment(upperControl, OFFSET);
- return data;
- }
-
- /**
- * Get the label of a graphical edit part
- *
- * @param editPart
- * the input part
- * @return the string label
- */
- public static String getLabel(IGraphicalEditPart editPart) {
- EObject eObject = editPart.resolveSemanticElement();
- return getCustomLabelProvider().getText(eObject);
- }
-
- /**
- * Gets the custom label provider that parses label for EClass
- *
- * @return the custom label provider
- */
- public static ILabelProvider getCustomLabelProvider() {
- if (adapterFactory == null) {
- adapterFactory = new AdapterFactoryLabelProvider(new UMLItemProviderAdapterFactory()) {
-
- /**
- * Override label provider for EClass
- *
- * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object object) {
- String text = super.getText(object);
- if (object instanceof EClass) {
- return text.substring(0, text.indexOf("[") - 1);
- } else {
- return text;
- }
- }
- };
- }
- return adapterFactory;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.groups.core.ui.utils; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Control; + +/** + * Provides usefull utility methods for ICompositeCreator instances + * + * @author vhemery + */ +public class CreatorUtils { + + /** The offset to use for form data */ + private static final int OFFSET = 5; + + /** The adapter factory to use as label provider */ + private static AdapterFactoryLabelProvider adapterFactory = null; + + /** + * Get the form layout data to place element at top of the parent composite + * + * @return form data + */ + public static FormData getTopFormData() { + FormData data = new FormData(); + data.right = new FormAttachment(100, -OFFSET); + data.left = new FormAttachment(0, OFFSET); + data.top = new FormAttachment(0, OFFSET); + return data; + } + + /** + * Get the form layout data to place element under another + * + * @param upperControl + * control under which the element must be located + * @return form data + */ + public static FormData getFormDataUnder(Control upperControl) { + FormData data = new FormData(); + data.right = new FormAttachment(100, -OFFSET); + data.left = new FormAttachment(0, OFFSET); + data.top = new FormAttachment(upperControl, OFFSET); + return data; + } + + /** + * Get the form layout data to place element under another, aligned on the right of the parent composite + * + * @param upperControl + * control under which the element must be located + * @return form data + */ + public static FormData getFormDataRightAlignedUnder(Control upperControl) { + FormData data = new FormData(); + data.right = new FormAttachment(100, -OFFSET); + data.top = new FormAttachment(upperControl, OFFSET); + return data; + } + + /** + * Get the label of a graphical edit part + * + * @param editPart + * the input part + * @return the string label + */ + public static String getLabel(IGraphicalEditPart editPart) { + EObject eObject = editPart.resolveSemanticElement(); + return getCustomLabelProvider().getText(eObject); + } + + /** + * Gets the custom label provider that parses label for EClass + * + * @return the custom label provider + */ + public static ILabelProvider getCustomLabelProvider() { + if (adapterFactory == null) { + adapterFactory = new AdapterFactoryLabelProvider(new InternationalizationUMLItemProviderAdapterFactory()) { + + /** + * Override label provider for EClass + * + * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#getText(java.lang.Object) + */ + @Override + public String getText(Object object) { + String text = super.getText(object); + if (object instanceof EClass) { + return text.substring(0, text.indexOf("[") - 1); + } else { + return text; + } + } + }; + } + return adapterFactory; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF index 7e61eb29ffe..8dafe015702 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF @@ -81,7 +81,12 @@ Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0 org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.hyperlink;bundle-version="[3.0.0,4.0.0)", - org.eclipse.nebula.widgets.richtext;bundle-version="[1.0.0,2.0.0)" + org.eclipse.nebula.widgets.richtext;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)";visibility:=reexport Bundle-Vendor: %providerName Bundle-Version: 3.0.0.qualifier Eclipse-BuddyPolicy: dependent diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index 78761f57646..c97ccf9bde8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -506,6 +506,9 @@ <strategy strategy="org.eclipse.papyrus.uml.diagram.common.strategy.paste.ConstraintPasteStrategy"> </strategy> + <strategy + strategy="org.eclipse.papyrus.uml.diagram.common.strategy.paste.InternationalizationPasteStrategy"> + </strategy> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.copyStrategy"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java index 1010d65f760..bc6788cc260 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java @@ -11,6 +11,7 @@ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 410346 * Christian W. Damus - bug 485220 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common; @@ -42,6 +43,7 @@ import org.eclipse.papyrus.uml.diagram.common.providers.AlternativeUMLItemProvid import org.eclipse.papyrus.uml.diagram.common.util.ColorManager; import org.eclipse.papyrus.uml.diagram.common.util.FontManager; import org.eclipse.papyrus.uml.diagram.internal.common.services.UMLGraphicalDeletionHelper; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; import org.eclipse.papyrus.uml.tools.utils.ElementUtil; import org.eclipse.papyrus.uml.tools.utils.ImageUtil; import org.eclipse.swt.graphics.Image; @@ -51,7 +53,6 @@ import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Stereotype; import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; @@ -653,7 +654,6 @@ public class Activator extends AbstractUIPlugin { // custom icons for diagram elements factories.add(new AlternativeUMLItemProviderAdapterFactory(getPreferenceStore())); - factories.add(new UMLItemProviderAdapterFactory()); factories.add(new EcoreItemProviderAdapterFactory()); factories.add(new ResourceItemProviderAdapterFactory()); factories.add(new ReflectiveItemProviderAdapterFactory()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/SelectModelElementsForDiagramDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/SelectModelElementsForDiagramDialog.java index 79ced9cbc53..eb4f37219ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/SelectModelElementsForDiagramDialog.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/SelectModelElementsForDiagramDialog.java @@ -6,7 +6,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation + * Contributors: + * Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * ******************************************************************************/ @@ -21,6 +23,7 @@ import org.eclipse.jface.viewers.IBaseLabelProvider; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -95,7 +98,7 @@ public class SelectModelElementsForDiagramDialog extends WizardPage { String label = ""; label += "<" + input.eClass().getName() + "> "; if (input instanceof NamedElement) { - label += ((NamedElement) input).getName() + " "; + label += UMLLabelInternationalization.getInstance().getLabel(((NamedElement) input)) + " "; } label += " is the root element"; rootElementLabel.setText(label); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java index 38b95bdb611..de656f469f7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java @@ -8,6 +8,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.editpolicies; @@ -41,6 +42,7 @@ import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; import org.eclipse.papyrus.uml.diagram.common.directedit.FigureControler; import org.eclipse.papyrus.uml.diagram.common.directedit.ILabelControler; import org.eclipse.papyrus.uml.diagram.common.directedit.PropertyAccessor; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; @@ -222,7 +224,7 @@ public class ExtendedDirectEditPolicy extends LabelDirectEditPolicy { if (isElementImport()) { return getElementImport().getAlias(); } else if (getUMLElement() instanceof NamedElement) { - return ((NamedElement) getUMLElement()).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement) getUMLElement())); } return ""; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ShortCutPreviewEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ShortCutPreviewEditPolicy.java index fe5ce88784b..36d9f35555c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ShortCutPreviewEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ShortCutPreviewEditPolicy.java @@ -8,6 +8,7 @@ * * Contributors: * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.editpolicies; @@ -23,6 +24,7 @@ import org.eclipse.gmf.runtime.diagram.ui.render.util.DiagramRenderUtil; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.commands.Activator; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusPopupBarEditPolicy; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; @@ -37,19 +39,19 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { private final double SCALE_FACTOR = 0.5; private int CUSTOM_ITEM_WIDTH; private int CUSTOM_ITEM_HEIGHT; - + private Diagram diagram; private Image previewImage; private Image scaledPreviewImage; private int maxHeight; private int maxWidth; - + public ShortCutPreviewEditPolicy() { super(); maxHeight = 0; maxWidth = 0; } - + @Override public void activate() { super.activate(); @@ -60,32 +62,32 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { } } } - + @Override public void deactivate() { super.deactivate(); if (previewImage != null) { previewImage.dispose(); } - + if (scaledPreviewImage != null) { scaledPreviewImage.dispose(); } } - + @Override protected void showDiagramAssistant(Point referencePoint) { if (diagram != null) { if (previewImage == null) { try { previewImage = DiagramRenderUtil.renderToSWTImage(diagram); - } catch(Exception e) { + } catch (Exception e) { Activator.log.error(e); } } else { int optimalWidth = (int) (this.getHost().getRoot().getViewer().getControl().getBounds().width * SCALE_FACTOR); int optimalHeight = (int) (this.getHost().getRoot().getViewer().getControl().getBounds().height * SCALE_FACTOR); - + if (scaledPreviewImage == null || optimalWidth != maxWidth || optimalHeight != maxHeight) { maxHeight = (int) optimalHeight; maxWidth = (int) optimalWidth; @@ -94,15 +96,15 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { } scaledPreviewImage = resize(previewImage, maxHeight, maxWidth); } - + CUSTOM_ITEM_WIDTH = scaledPreviewImage.getBounds().width; CUSTOM_ITEM_HEIGHT = scaledPreviewImage.getBounds().height; - + super.showDiagramAssistant(referencePoint); } } } - + /** * initialize the popup bars from the list of action descriptors. */ @@ -146,21 +148,21 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { b.addMouseListener(this.myMouseKeyListener); } } - + @Override protected void appendPopupBarDescriptors() { - addPopupBarDescriptor(null, scaledPreviewImage, null, "Preview of " + diagram.getName()); // IElementType, Image, DragTracker, String + addPopupBarDescriptor(null, scaledPreviewImage, null, "Preview of " + LabelInternationalization.getInstance().getDiagramLabel(diagram)); // IElementType, Image, DragTracker, String } - + private Image resize(Image image, int maxWidth, int maxHeight) { double widthD = image.getBounds().width; double heightD = image.getBounds().height; double maxWidthD = maxWidth; double maxHeightD = maxHeight; - + if (widthD > maxWidthD || heightD > maxHeightD) { Double scale = 1.0; - + if (widthD > maxWidthD && heightD > maxHeightD) { if (widthD >= heightD) { scale = maxWidthD / widthD; @@ -174,7 +176,7 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { scale = maxHeightD / heightD; } } - + int scaledWidth = (int) (widthD * scale); int scaledHeight = (int) (heightD * scale); @@ -192,7 +194,7 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { return image; } } - + /** * The preview image handler * @@ -201,7 +203,7 @@ public class ShortCutPreviewEditPolicy extends PapyrusPopupBarEditPolicy { public PreviewPopupBarLabelHandle(Image theImage) { super(null, theImage); } - + /** * @see org.eclipse.draw2d.IFigure#handleMouseEntered(org.eclipse.draw2d.MouseEvent) * flip myMouseOver bit and repaint diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/ActivityParameterNodeLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/ActivityParameterNodeLabelHelper.java index 26520778547..223a1036993 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/ActivityParameterNodeLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/ActivityParameterNodeLabelHelper.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -20,6 +21,7 @@ import java.util.Map; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.ActivityParameterNode; import org.eclipse.uml2.uml.NamedElement; @@ -112,7 +114,7 @@ public class ActivityParameterNodeLabelHelper extends StereotypedElementLabelHel if (values.contains(ICustomAppearance.DISP_STATE)) { StringBuffer stateLabel = new StringBuffer(); for (State state : node.getInStates()) { - String stateName = state.getName(); + String stateName = UMLLabelInternationalization.getInstance().getLabel(state); if (stateName != null && stateName.length() > 0) { if (stateLabel.length() > 0) { stateLabel.append(STATE_SEPARATOR); @@ -134,7 +136,7 @@ public class ActivityParameterNodeLabelHelper extends StereotypedElementLabelHel if (element == null) { return; } - String name = element.getName(); + final String name = UMLLabelInternationalization.getInstance().getLabel(element); if (name != null && name.length() > 0) { if (builder.length() > 0) { builder.append(SEPARATOR); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/DurationObservationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/DurationObservationHelper.java index e5b95d032e4..092ac578b59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/DurationObservationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/DurationObservationHelper.java @@ -9,6 +9,7 @@ * * Contributors: * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.helper; @@ -19,6 +20,7 @@ import java.util.List; import org.eclipse.emf.ecore.EStructuralFeature.Setting; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.DurationObservation; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OccurrenceSpecification; @@ -79,7 +81,7 @@ public class DurationObservationHelper { * @return string */ public static String getLabelString(DurationObservation observation) { - return String.format(DURATION_OBSERVATION_LABEL_FORMAT, observation.getName()); + return String.format(DURATION_OBSERVATION_LABEL_FORMAT, UMLLabelInternationalization.getInstance().getLabel(observation)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/EnumerationLiteralLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/EnumerationLiteralLabelHelper.java index 8664cea86ca..94cbd23cde0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/EnumerationLiteralLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/EnumerationLiteralLabelHelper.java @@ -1,98 +1,100 @@ -/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * 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:
- * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
- * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 472034
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.common.helper;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-
-/**
- * Label Helper for Enumeration Literal. It is used to compute the Label of the Enumeration Literal EditPart.
- *
- * @author Céline JANSSENS
- *
- */
-public class EnumerationLiteralLabelHelper extends StereotypedElementLabelHelper {
-
- /**
- * singleton instance
- */
- private static EnumerationLiteralLabelHelper labelHelper;
-
- /**
- * Returns the singleton instance of this class
- *
- * @return the singleton instance.
- */
- public static EnumerationLiteralLabelHelper getInstance() {
- if (null == labelHelper) {
- labelHelper = new EnumerationLiteralLabelHelper();
- }
- return labelHelper;
- }
-
- /** Map for masks */
- protected final Map<String, String> masks = new HashMap<String, String>();
-
- /**
- * Creates a new Operation label helper.
- */
- protected EnumerationLiteralLabelHelper() {
- // initialize the map
- masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility");
- masks.put(ICustomAppearance.DISP_NAME, "Name");
- }
-
- /**
- * Computes the label that should be displayed by the figure managed by this
- * edit part.
- *
- * @param editPart
- * the edit part that controls the {@link Operation} to be
- * displayed
- * @return the label corresponding to the specific display of the property
- * ("default" display given by preferences or specific display given
- * by eAnnotation).
- */
- @Override
- protected String elementLabel(GraphicalEditPart editPart) {
- NamedElement namedElement = getUMLElement(editPart);
- return namedElement == null ? "" : namedElement.getName();
- }
-
- /**
- * Returns the makp of masks used to display an {@link Operation}
- *
- * @return the {@link Map} of masks used to display a {@link Operation}
- */
- public Map<String, String> getMasks() {
- return masks;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EnumerationLiteral getUMLElement(GraphicalEditPart editPart) {
- return (EnumerationLiteral) ((View) editPart.getModel()).getElement();
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2015 CEA LIST and others. + * + * 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: + * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation + * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 472034 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.common.helper; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.uml2.uml.EnumerationLiteral; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; + +/** + * Label Helper for Enumeration Literal. It is used to compute the Label of the Enumeration Literal EditPart. + * + * @author Céline JANSSENS + * + */ +public class EnumerationLiteralLabelHelper extends StereotypedElementLabelHelper { + + /** + * singleton instance + */ + private static EnumerationLiteralLabelHelper labelHelper; + + /** + * Returns the singleton instance of this class + * + * @return the singleton instance. + */ + public static EnumerationLiteralLabelHelper getInstance() { + if (null == labelHelper) { + labelHelper = new EnumerationLiteralLabelHelper(); + } + return labelHelper; + } + + /** Map for masks */ + protected final Map<String, String> masks = new HashMap<String, String>(); + + /** + * Creates a new Operation label helper. + */ + protected EnumerationLiteralLabelHelper() { + // initialize the map + masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); + masks.put(ICustomAppearance.DISP_NAME, "Name"); + } + + /** + * Computes the label that should be displayed by the figure managed by this + * edit part. + * + * @param editPart + * the edit part that controls the {@link Operation} to be + * displayed + * @return the label corresponding to the specific display of the property + * ("default" display given by preferences or specific display given + * by eAnnotation). + */ + @Override + protected String elementLabel(GraphicalEditPart editPart) { + NamedElement namedElement = getUMLElement(editPart); + return namedElement == null ? "" : UMLLabelInternationalization.getInstance().getLabel(namedElement); + } + + /** + * Returns the makp of masks used to display an {@link Operation} + * + * @return the {@link Map} of masks used to display a {@link Operation} + */ + public Map<String, String> getMasks() { + return masks; + } + + /** + * {@inheritDoc} + */ + @Override + public EnumerationLiteral getUMLElement(GraphicalEditPart editPart) { + return (EnumerationLiteral) ((View) editPart.getModel()).getElement(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/FloatingLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/FloatingLabelHelper.java index 2f0fdcc0bc4..44b764d80b8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/FloatingLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/FloatingLabelHelper.java @@ -8,6 +8,7 @@ * * Contributors: * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.helper; @@ -21,6 +22,7 @@ import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; @@ -241,7 +243,7 @@ public class FloatingLabelHelper extends StereotypedElementLabelHelper { // name if (maskValues.contains(ICustomAppearance.DISP_NAME)) { buffer.append(ONE_SPACE); - final String name = namedElement.getName(); + final String name = UMLLabelInternationalization.getInstance().getLabel(namedElement); buffer.append(name != null ? name : EMPTY); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java index f5686f6ee99..93c00fb4faf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -22,6 +22,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; @@ -86,7 +87,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && property.isSetName()) { - String name = property.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(property); // If property is owned by Association (non navigable) only show the name when explicitly asked. @@ -100,7 +101,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (property.getType() != null) { - type = property.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. @@ -124,7 +125,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { // manage default value if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification)); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); } // manage modifier @@ -145,7 +146,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser { EList<Property> redefinedProperties = property.getRedefinedProperties(); if (redefinedProperties != null && !redefinedProperties.isEmpty()) { for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName()); + sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); } } if (sb.length() != 0) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java index 359a2871d4d..c5a1471b906 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -25,6 +25,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Connector; import org.eclipse.uml2.uml.UMLPackage; @@ -61,7 +62,7 @@ public class ConnectorLabelParser extends NamedElementLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && (connector.isSetName())) { - String name = connector.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(connector); result = String.format(NAME_FORMAT, name); } @@ -69,7 +70,7 @@ public class ConnectorLabelParser extends NamedElementLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (connector.getType() != null) { - type = connector.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(connector.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java index 65c186de0b0..87a03052d44 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -28,10 +28,14 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Constraint; @@ -70,7 +74,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // edit name if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { if (semElement.isSetName()) { - editString = semElement.getName(); + editString = UMLLabelInternationalization.getInstance().getLabel(semElement); } // (try to) edit constraint specification @@ -106,7 +110,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // manage name if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (semElement.isSetName())) { - String name = semElement.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(semElement); result = String.format(NAME_FORMAT, name); } @@ -114,7 +118,7 @@ public class ConstraintLabelParser extends NamedElementLabelParser { if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { String spec = "<Undefined>"; if (semElement.getSpecification() != null) { - spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification()); + spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification(), true); if (spec == null || "".equals(spec)) { spec = "<Undefined>"; } @@ -143,8 +147,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser { // prepare set name request if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { - updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); - updateRequest.setLabel("Update Constraint Label"); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(constraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(constraint)){ + final ModelSet modelSet = (ModelSet)constraint.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), constraint, newString, null)); + }else{ + updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + updateRequest.setLabel("Update Constraint Label"); + } // prepare set specification request } else if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java index c02688175cb..28cfee1021b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -98,8 +98,8 @@ public class MultiplicityElementLabelParser implements IMaskManagedSemanticParse // If multiplicity is [1] (SysML default), only show when explicitly asked. // TODO : add a case for default with multiplicity not set. - String lower = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getLowerValue()) : "1"; - String upper = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getUpperValue()) : "1"; + String lower = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getLowerValue(), true) : "1"; + String upper = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getUpperValue(), true) : "1"; if (maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) { if (lower.equals(upper)) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java index f35c93eef23..1da684d9783 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -31,11 +31,15 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.UMLPackage; @@ -55,7 +59,7 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { if ((eObject != null) && (eObject instanceof NamedElement)) { NamedElement semElement = (NamedElement) eObject; if (semElement.isSetName()) { - editString = semElement.getName(); + editString = UMLLabelInternationalization.getInstance().getLabel(semElement); } } return editString; @@ -83,7 +87,12 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { } try { - command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(objectToEdit) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)objectToEdit)){ + final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); + }else{ + command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + } } catch (ServiceException e) { Activator.log.error(e); } @@ -100,7 +109,7 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { EObject eObject = EMFHelper.getEObject(element); if (eObject instanceof NamedElement) { - return ((NamedElement) eObject).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement) eObject)); } return result; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java index 763001bcf64..9c81f8ed53c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -29,6 +29,7 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.tools.util.StringHelper; import org.eclipse.papyrus.uml.diagram.common.util.ParameterLabelUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Operation; import org.eclipse.uml2.uml.Parameter; @@ -100,7 +101,7 @@ public class OperationLabelParser extends NamedElementLabelParser { // manage name and parameters if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (operation.isSetName())) { - String name = operation.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(operation); StringBuffer params = new StringBuffer(); for (Parameter parameter : operation.getOwnedParameters()) { @@ -117,7 +118,7 @@ public class OperationLabelParser extends NamedElementLabelParser { if ((maskValues.contains(ICustomAppearance.DISP_TYPE))) { String type = "<Undefined>"; if (operation.getType() != null) { - type = operation.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(operation.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java index c6da9e1195f..bdde3d86acb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -26,6 +26,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Property; @@ -111,7 +112,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && (property.isSetName())) { - String name = property.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(property); result = String.format(NAME_FORMAT, result, name); } @@ -119,7 +120,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { String type = "<Undefined>"; if (property.getType() != null) { - type = property.getType().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); } // If type is undefined only show "<Undefined>" when explicitly asked. @@ -133,8 +134,8 @@ public class PropertyLabelParser extends NamedElementLabelParser { // If multiplicity is [1] (SysML default), only show when explicitly asked. // TODO : add a case for default with multiplicity not set. - String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1"; - String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1"; + String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue(), true) : "1"; + String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue(), true) : "1"; if (maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) { if (lower.equals(upper)) { @@ -148,7 +149,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { // manage default value if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification)); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); } // manage modifier @@ -169,7 +170,7 @@ public class PropertyLabelParser extends NamedElementLabelParser { EList<Property> redefinedProperties = property.getRedefinedProperties(); if (redefinedProperties != null && !redefinedProperties.isEmpty()) { for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName()); + sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); } } if (sb.length() != 0) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java index f4e9fdfa9a8..43954913aea 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -25,6 +25,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.uml2.uml.Reception; import org.eclipse.uml2.uml.UMLPackage; @@ -64,7 +65,7 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa // manage name if (maskValues.contains(ICustomAppearance.DISP_NAME) && reception.isSetName()) { - String name = reception.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(reception); result = String.format(NAME_FORMAT, result, name); } @@ -72,7 +73,7 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa if (maskValues.contains(ILabelPreferenceConstants.DISP_SIGNAL)) { String type = "<Undefined>"; if (reception.getSignal() != null) { - type = reception.getSignal().getName(); + type = UMLLabelInternationalization.getInstance().getLabel(reception.getSignal()); } result = String.format(TYPE_FORMAT, result, type); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ShortcutDiagramParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ShortcutDiagramParser.java index 72219cf4f00..e2be615875a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ShortcutDiagramParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ShortcutDiagramParser.java @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier(CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -27,8 +28,13 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.common.Messages; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; /** * parser to display the name of diagram in the case of a short cut @@ -47,7 +53,7 @@ public class ShortcutDiagramParser implements IParser { return Messages.DiagramNotFound; } - return diagram.getName(); + return LabelInternationalization.getInstance().getDiagramLabel(diagram); } /** @@ -73,9 +79,15 @@ public class ShortcutDiagramParser implements IParser { if (editingDomain == null) { return UnexecutableCommand.INSTANCE; } - CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, Messages.SetNameDiagram); - SetRequest request = new SetRequest(diagram, NotationPackage.eINSTANCE.getDiagram_Name(), newString); - command.compose(new SetValueCommand(request)); + ICommand command = null; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(diagram) && null != LabelInternationalization.getInstance().getDiagramLabel(diagram)) { + final ModelSet modelSet = (ModelSet) diagram.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(LabelInternationalization.getInstance().getSetDiagramLabelCommand(modelSet.getTransactionalEditingDomain(), diagram, newString, null)); + } else { + command = new CompositeTransactionalCommand(editingDomain, Messages.SetNameDiagram); + SetRequest request = new SetRequest(diagram, NotationPackage.eINSTANCE.getDiagram_Name(), newString); + command.compose(new SetValueCommand(request)); + } return command; } @@ -90,7 +102,7 @@ public class ShortcutDiagramParser implements IParser { return Messages.DiagramNotFound; } - return diagram.getName(); + return LabelInternationalization.getInstance().getDiagramLabel(diagram); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/TagsAdderParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/TagsAdderParser.java index 81eaa681024..245dd17c97a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/TagsAdderParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/TagsAdderParser.java @@ -5,8 +5,10 @@ * Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * - * Contributors: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * Javier Muñoz (Prodevelop) – Added ISemanticParser implementation + * Contributors: + * Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation + * Javier Muñoz (Prodevelop) – Added ISemanticParser implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * ******************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser; @@ -22,6 +24,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Stereotype; @@ -112,7 +115,7 @@ public class TagsAdderParser implements ISemanticParser { List<Stereotype> stereotypes = element.getAppliedStereotypes(); for (Stereotype st : stereotypes) { - String name = st.getName(); + String name = UMLLabelInternationalization.getInstance().getKeyword(st); if (name != null) { stereotypesNames.add(name); } else { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/AssociationEndParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/AssociationEndParser.java index aa742047023..c8c62b07545 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/AssociationEndParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/AssociationEndParser.java @@ -7,13 +7,15 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Thibault Landre (Atos Origin) - Initial API and implementation + * Thibault Landre (Atos Origin) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * ****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser.custom; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; import org.eclipse.papyrus.uml.tools.utils.PropertyUtil; import org.eclipse.uml2.uml.Property; @@ -83,7 +85,7 @@ public class AssociationEndParser extends AbstractAssociationEndParser { displayedString.append(PropertyUtil.getDerived(property)); // name if (property.getName() != null) { - displayedString.append(property.getName()); + displayedString.append(UMLLabelInternationalization.getInstance().getLabel(property)); } // modifiers diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/OnlyStereotypesNamesParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/OnlyStereotypesNamesParser.java index 3254a7ade88..89576e02608 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/OnlyStereotypesNamesParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/custom/OnlyStereotypesNamesParser.java @@ -10,6 +10,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Stereotype; @@ -49,7 +50,7 @@ public class OnlyStereotypesNamesParser implements IParser { String pString = "" + ((char) 171); for (java.util.Iterator<Stereotype> it = stereotypes.iterator(); it.hasNext();) { - pString += it.next().getName(); + pString += UMLLabelInternationalization.getInstance().getKeyword(it.next()); if (it.hasNext()) { pString += ", "; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java index a0705fad10b..80ad9bdcee5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java @@ -9,6 +9,7 @@ * Contributors: * Michael Golubev (Borland) - initial API and implementation * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 Stereotype Display + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.parser.stereotype; @@ -28,6 +29,7 @@ import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.papyrus.uml.diagram.common.parser.assist.FixedSetCompletionProcessor; import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Extension; import org.eclipse.uml2.uml.Stereotype; @@ -92,7 +94,7 @@ public class AppliedStereotypeParser implements ISemanticParser { if (result.length() > 0) { result.append(", "); //$NON-NLS-1$ } - result.append(next.getName()); + result.append(UMLLabelInternationalization.getInstance().getKeyword(next)); } return result.toString(); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java index 8191da91805..1aa258833df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java @@ -1,6 +1,16 @@ -/** +/***************************************************************************** + * Copyright (c) 2016 CEA LIST. * - */ + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.part; import org.eclipse.core.commands.operations.IUndoContext; @@ -14,8 +24,13 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.ReconcileHelper; import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils; +import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage; +import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; @@ -28,7 +43,7 @@ import org.eclipse.ui.contexts.IContextService; * @author cedric dumoulin * */ -public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor { +public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor implements IInternationalizationEditor { /** * The associated Diagram. @@ -60,6 +75,9 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor { // Install synchronizer partNameSynchronizer = new PartNameSynchronizer(diagram); + // Need to manage the part label synchronizer for the table labels + LabelInternationalizationUtils.managePartLabelSynchronizer(diagram, this); + // Register this part to the ISaveAndDirtyService. // This will allows to be notified of saveAs events, and the isDirty // flag will be taken into @@ -186,7 +204,9 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor { @Override public void notifyChanged(Notification notification) { if (notification.getFeatureID(Diagram.class) == NotationPackage.DIAGRAM__NAME && notification.getNotifier() == diagram) { - setPartName(diagram.getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(diagram)); + } else if (notification.getFeature() == InternationalizationPackage.eINSTANCE.getInternationalizationEntry_Value() && notification.getNotifier() == diagram) { + setPartName(LabelInternationalization.getInstance().getDiagramLabel(diagram)); } } @@ -231,7 +251,7 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor { // Set new Diagram this.diagram = diagram; // Set editor name - setPartName(diagram.getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(diagram)); // Listen to name change diagram.eAdapters().add(diagramNameListener); } @@ -246,4 +266,24 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor { super.createPartControl(parent); } + + /** + * @see org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor#modifyPartName(java.lang.String) + * + * @param name + */ + @Override + public void modifyPartName(final String name) { + setPartName(name); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor#refreshEditorPart() + */ + @Override + public void refreshEditorPart(){ + DiagramHelper.forceRefresh(getDiagramEditPart()); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AlternativeUMLItemProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AlternativeUMLItemProviderAdapterFactory.java index 3c8096f9107..22c01c0bc20 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AlternativeUMLItemProviderAdapterFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/AlternativeUMLItemProviderAdapterFactory.java @@ -6,7 +6,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation + * Contributors: + * Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * ******************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.providers; @@ -17,10 +19,12 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.papyrus.uml.diagram.common.preferences.UMLPreferencesConstants; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; +import org.eclipse.papyrus.uml.internationalization.edit.utils.InternationalizationElementItemProviderUtils; import org.eclipse.uml2.uml.edit.providers.*; import org.osgi.framework.Bundle; -public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAdapterFactory { +public class AlternativeUMLItemProviderAdapterFactory extends InternationalizationUMLItemProviderAdapterFactory { public AlternativeUMLItemProviderAdapterFactory(IPreferenceStore preferenceStore) { myPreferenceStore = preferenceStore; @@ -38,6 +42,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return commentItemProvider; @@ -55,6 +69,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return dependencyItemProvider; @@ -72,6 +96,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return templateParameterItemProvider; @@ -89,6 +123,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return templateSignatureItemProvider; @@ -106,6 +150,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return templateBindingItemProvider; @@ -123,6 +177,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return templateParameterSubstitutionItemProvider; @@ -140,6 +204,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return elementImportItemProvider; @@ -157,6 +231,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return packageImportItemProvider; @@ -174,6 +258,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return packageItemProvider; @@ -191,6 +285,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return packageMergeItemProvider; @@ -208,6 +312,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return profileApplicationItemProvider; @@ -225,6 +339,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return profileItemProvider; @@ -242,6 +366,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return stereotypeItemProvider; @@ -259,6 +393,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return imageItemProvider; @@ -276,6 +420,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return classItemProvider; @@ -293,6 +447,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return generalizationItemProvider; @@ -310,6 +474,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return generalizationSetItemProvider; @@ -327,6 +501,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return useCaseItemProvider; @@ -344,6 +528,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return includeItemProvider; @@ -361,6 +555,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return extendItemProvider; @@ -378,6 +582,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return constraintItemProvider; @@ -395,6 +609,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return extensionPointItemProvider; @@ -412,6 +636,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return substitutionItemProvider; @@ -429,6 +663,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return realizationItemProvider; @@ -446,6 +690,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return abstractionItemProvider; @@ -463,6 +717,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return opaqueExpressionItemProvider; @@ -480,6 +744,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return parameterItemProvider; @@ -497,6 +771,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return connectorEndItemProvider; @@ -514,6 +798,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return propertyItemProvider; @@ -531,6 +825,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return deploymentItemProvider; @@ -548,6 +852,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return deploymentSpecificationItemProvider; @@ -565,6 +879,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return artifactItemProvider; @@ -582,6 +906,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return manifestationItemProvider; @@ -599,6 +933,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return operationItemProvider; @@ -616,6 +960,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return parameterSetItemProvider; @@ -633,6 +987,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return dataTypeItemProvider; @@ -650,6 +1014,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interfaceItemProvider; @@ -667,6 +1041,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return receptionItemProvider; @@ -684,6 +1068,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return signalItemProvider; @@ -701,6 +1095,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return protocolStateMachineItemProvider; @@ -718,6 +1122,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return stateMachineItemProvider; @@ -735,6 +1149,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return regionItemProvider; @@ -752,6 +1176,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return transitionItemProvider; @@ -769,6 +1203,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return triggerItemProvider; @@ -786,6 +1230,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return portItemProvider; @@ -803,6 +1257,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return stateItemProvider; @@ -820,6 +1284,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return connectionPointReferenceItemProvider; @@ -837,6 +1311,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return pseudostateItemProvider; @@ -854,6 +1338,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return protocolConformanceItemProvider; @@ -871,6 +1365,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return operationTemplateParameterItemProvider; @@ -888,6 +1392,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return associationItemProvider; @@ -905,6 +1419,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return connectableElementTemplateParameterItemProvider; @@ -922,6 +1446,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return collaborationUseItemProvider; @@ -939,6 +1473,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return collaborationItemProvider; @@ -956,6 +1500,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return connectorItemProvider; @@ -973,6 +1527,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return redefinableTemplateSignatureItemProvider; @@ -990,6 +1554,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return classifierTemplateParameterItemProvider; @@ -1007,6 +1581,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interfaceRealizationItemProvider; @@ -1024,6 +1608,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return extensionItemProvider; @@ -1041,6 +1635,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return extensionEndItemProvider; @@ -1058,6 +1662,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return stringExpressionItemProvider; @@ -1075,6 +1689,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return expressionItemProvider; @@ -1092,6 +1716,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return literalIntegerItemProvider; @@ -1109,6 +1743,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return literalStringItemProvider; @@ -1126,6 +1770,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return literalBooleanItemProvider; @@ -1143,6 +1797,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return literalNullItemProvider; @@ -1160,6 +1824,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return slotItemProvider; @@ -1177,6 +1851,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return instanceSpecificationItemProvider; @@ -1194,6 +1878,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return enumerationItemProvider; @@ -1211,6 +1905,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return enumerationLiteralItemProvider; @@ -1228,6 +1932,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return primitiveTypeItemProvider; @@ -1245,6 +1959,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return instanceValueItemProvider; @@ -1262,6 +1986,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return literalUnlimitedNaturalItemProvider; @@ -1279,6 +2013,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return opaqueBehaviorItemProvider; @@ -1296,6 +2040,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return functionBehaviorItemProvider; @@ -1313,6 +2067,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return actorItemProvider; @@ -1330,6 +2094,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return usageItemProvider; @@ -1347,6 +2121,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return messageItemProvider; @@ -1364,6 +2148,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interactionItemProvider; @@ -1381,6 +2175,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return lifelineItemProvider; @@ -1398,6 +2202,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return partDecompositionItemProvider; @@ -1415,6 +2229,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interactionUseItemProvider; @@ -1432,6 +2256,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return gateItemProvider; @@ -1449,6 +2283,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return activityItemProvider; @@ -1466,6 +2310,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return activityPartitionItemProvider; @@ -1483,6 +2337,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return structuredActivityNodeItemProvider; @@ -1500,6 +2364,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return variableItemProvider; @@ -1517,6 +2391,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interruptibleActivityRegionItemProvider; @@ -1534,6 +2418,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return exceptionHandlerItemProvider; @@ -1551,6 +2445,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return outputPinItemProvider; @@ -1570,6 +2474,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return inputPinItemProvider; @@ -1587,6 +2501,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return generalOrderingItemProvider; @@ -1604,6 +2528,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return occurrenceSpecificationItemProvider; @@ -1621,6 +2555,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interactionOperandItemProvider; @@ -1638,6 +2582,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return interactionConstraintItemProvider; @@ -1655,6 +2609,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return executionOccurrenceSpecificationItemProvider; @@ -1675,6 +2639,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return stateInvariantItemProvider; @@ -1692,6 +2666,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return actionExecutionSpecificationItemProvider; @@ -1709,6 +2693,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return behaviorExecutionSpecificationItemProvider; @@ -1730,6 +2724,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return messageOccurrenceSpecificationItemProvider; @@ -1748,6 +2752,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return combinedFragmentItemProvider; @@ -1765,6 +2779,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return continuationItemProvider; @@ -1782,6 +2806,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return considerIgnoreFragmentItemProvider; @@ -1799,6 +2833,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return callEventItemProvider; @@ -1816,6 +2860,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return changeEventItemProvider; @@ -1833,6 +2887,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return signalEventItemProvider; @@ -1850,6 +2914,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return anyReceiveEventItemProvider; @@ -1867,6 +2941,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return createObjectActionItemProvider; @@ -1884,6 +2968,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return destroyObjectActionItemProvider; @@ -1901,6 +2995,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return testIdentityActionItemProvider; @@ -1918,6 +3022,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readSelfActionItemProvider; @@ -1935,6 +3049,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readStructuralFeatureActionItemProvider; @@ -1952,6 +3076,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return clearStructuralFeatureActionItemProvider; @@ -1969,6 +3103,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return removeStructuralFeatureValueActionItemProvider; @@ -1986,6 +3130,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return addStructuralFeatureValueActionItemProvider; @@ -2003,6 +3157,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return linkEndDataItemProvider; @@ -2020,6 +3184,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return qualifierValueItemProvider; @@ -2037,6 +3211,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readLinkActionItemProvider; @@ -2054,6 +3238,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return linkEndCreationDataItemProvider; @@ -2071,6 +3265,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return createLinkActionItemProvider; @@ -2088,6 +3292,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return destroyLinkActionItemProvider; @@ -2105,6 +3319,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return linkEndDestructionDataItemProvider; @@ -2122,6 +3346,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return clearAssociationActionItemProvider; @@ -2139,6 +3373,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return broadcastSignalActionItemProvider; @@ -2156,6 +3400,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return sendObjectActionItemProvider; @@ -2173,6 +3427,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return valueSpecificationActionItemProvider; @@ -2190,6 +3454,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return timeExpressionItemProvider; @@ -2207,6 +3481,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return durationItemProvider; @@ -2224,6 +3508,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return valuePinItemProvider; @@ -2241,6 +3535,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return durationIntervalItemProvider; @@ -2258,6 +3562,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return intervalItemProvider; @@ -2275,6 +3589,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return timeConstraintItemProvider; @@ -2292,6 +3616,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return intervalConstraintItemProvider; @@ -2309,6 +3643,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return timeIntervalItemProvider; @@ -2326,6 +3670,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return durationConstraintItemProvider; @@ -2343,6 +3697,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return timeObservationItemProvider; @@ -2360,6 +3724,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return durationObservationItemProvider; @@ -2377,6 +3751,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return opaqueActionItemProvider; @@ -2394,6 +3778,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return sendSignalActionItemProvider; @@ -2411,6 +3805,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return callOperationActionItemProvider; @@ -2428,6 +3832,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return callBehaviorActionItemProvider; @@ -2445,6 +3859,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return informationItemItemProvider; @@ -2462,6 +3886,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return informationFlowItemProvider; @@ -2479,6 +3913,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return modelItemProvider; @@ -2496,6 +3940,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readVariableActionItemProvider; @@ -2513,6 +3967,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return clearVariableActionItemProvider; @@ -2530,6 +3994,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return addVariableValueActionItemProvider; @@ -2547,6 +4021,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return removeVariableValueActionItemProvider; @@ -2564,6 +4048,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return raiseExceptionActionItemProvider; @@ -2581,6 +4075,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return actionInputPinItemProvider; @@ -2598,6 +4102,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readExtentActionItemProvider; @@ -2615,6 +4129,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return reclassifyObjectActionItemProvider; @@ -2632,6 +4156,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readIsClassifiedObjectActionItemProvider; @@ -2649,6 +4183,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return startClassifierBehaviorActionItemProvider; @@ -2666,6 +4210,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readLinkObjectEndActionItemProvider; @@ -2683,6 +4237,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return readLinkObjectEndQualifierActionItemProvider; @@ -2700,6 +4264,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return createLinkObjectActionItemProvider; @@ -2717,6 +4291,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return acceptEventActionItemProvider; @@ -2734,6 +4318,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return acceptCallActionItemProvider; @@ -2751,6 +4345,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return replyActionItemProvider; @@ -2768,6 +4372,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return unmarshallActionItemProvider; @@ -2785,6 +4399,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return reduceActionItemProvider; @@ -2802,6 +4426,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return controlFlowItemProvider; @@ -2819,6 +4453,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return initialNodeItemProvider; @@ -2836,6 +4480,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return activityParameterNodeItemProvider; @@ -2853,6 +4507,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return forkNodeItemProvider; @@ -2870,6 +4534,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return flowFinalNodeItemProvider; @@ -2887,6 +4561,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return centralBufferNodeItemProvider; @@ -2904,6 +4588,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return mergeNodeItemProvider; @@ -2921,6 +4615,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return decisionNodeItemProvider; @@ -2938,6 +4642,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return activityFinalNodeItemProvider; @@ -2955,6 +4669,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return joinNodeItemProvider; @@ -2972,6 +4696,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return dataStoreNodeItemProvider; @@ -2989,6 +4723,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return objectFlowItemProvider; @@ -3006,6 +4750,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return sequenceNodeItemProvider; @@ -3023,6 +4777,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return conditionalNodeItemProvider; @@ -3040,6 +4804,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return clauseItemProvider; @@ -3057,6 +4831,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return loopNodeItemProvider; @@ -3074,6 +4858,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return expansionNodeItemProvider; @@ -3091,6 +4885,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return expansionRegionItemProvider; @@ -3108,6 +4912,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return componentRealizationItemProvider; @@ -3125,6 +4939,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return componentItemProvider; @@ -3142,6 +4966,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return nodeItemProvider; @@ -3159,6 +4993,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return deviceItemProvider; @@ -3176,6 +5020,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return executionEnvironmentItemProvider; @@ -3193,6 +5047,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return communicationPathItemProvider; @@ -3210,6 +5074,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return finalStateItemProvider; @@ -3227,6 +5101,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return timeEventItemProvider; @@ -3244,6 +5128,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return protocolTransitionItemProvider; @@ -3261,6 +5155,16 @@ public class AlternativeUMLItemProviderAdapterFactory extends UMLItemProviderAda } return super.getImage(object); } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } }; } return associationClassItemProvider; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/BasicEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/BasicEditPartProvider.java index 96afde903d4..4b0e1d2a182 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/BasicEditPartProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/BasicEditPartProvider.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.providers; @@ -42,6 +42,7 @@ import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart; import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart; import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; @@ -130,7 +131,7 @@ public class BasicEditPartProvider extends AbstractEditPartProvider { protected void handleNotificationEvent(Notification event) { if( resolveSemanticElement()!=null){ - primaryShape.setName(((NamedElement)getNotationView().getElement()).getName());} + primaryShape.setName(UMLLabelInternationalization.getInstance().getLabel(((NamedElement)getNotationView().getElement())));} super.handleNotificationEvent(event); } @@ -185,7 +186,7 @@ public class BasicEditPartProvider extends AbstractEditPartProvider { getPrimaryShape().getAppliedStereotypeLabel().setBorder(new LineBorder(new Color(Display.getDefault(), new RGB(0, 255, 0)))); getPrimaryShape().getNameLabel().setBorder(new LineBorder(new Color(Display.getDefault(), new RGB(255, 0, 0)))); - getPrimaryShape().getNameLabel().setText(((NamedElement)getNotationView().getElement()).getName());} + getPrimaryShape().getNameLabel().setText(UMLLabelInternationalization.getInstance().getLabel((NamedElement)getNotationView().getElement()));} super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/UMLComposedAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/UMLComposedAdapterFactory.java index a6639f52644..fb65cd102c5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/UMLComposedAdapterFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/UMLComposedAdapterFactory.java @@ -7,17 +7,19 @@ * * Contributors: * Atos Origin - initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *******************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.providers; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; import org.eclipse.uml2.uml.edit.providers.UMLResourceItemProviderAdapterFactory; public class UMLComposedAdapterFactory extends ComposedAdapterFactory { - private static final AdapterFactory[] factories = { new UMLResourceItemProviderAdapterFactory(), new UMLItemProviderAdapterFactory() }; + private static final AdapterFactory[] factories = { new UMLResourceItemProviderAdapterFactory(), new InternationalizationUMLItemProviderAdapterFactory() }; public UMLComposedAdapterFactory() { super(factories); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java index 28134892207..eaf7510a8b7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java @@ -7,7 +7,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.service.palette; @@ -39,6 +41,7 @@ import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusCons import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil; import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -346,7 +349,7 @@ public class DisplayAppliedStereotypePropertiesInCompartmentPostAction extends G StringBuilder buffer = new StringBuilder(); buffer.append(stereotype.getQualifiedName()); buffer.append("."); - buffer.append(property.getName()); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(property)); return buffer.toString(); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/PropertyRepresentation.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/PropertyRepresentation.java index 0f62b24e807..9ffc123c44b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/PropertyRepresentation.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/PropertyRepresentation.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.service.palette; @@ -16,6 +17,7 @@ package org.eclipse.papyrus.uml.diagram.common.service.palette; import java.util.ArrayList; import org.eclipse.core.runtime.Assert; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.Type; @@ -217,7 +219,7 @@ public class PropertyRepresentation { */ public void setUMLProperty(Property property) { this.umlProperty = property; - this.name = property.getName(); + this.name = UMLLabelInternationalization.getInstance().getLabel(property); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/InternationalizationPasteStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/InternationalizationPasteStrategy.java new file mode 100644 index 00000000000..2acb0edaac7 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/InternationalizationPasteStrategy.java @@ -0,0 +1,130 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.common.strategy.paste; + +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard; +import org.eclipse.papyrus.infra.gmfdiag.common.Activator; +import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.AbstractPasteStrategy; +import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.DefaultPasteStrategy; +import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy; +import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry; +import org.eclipse.papyrus.infra.internationalization.utils.commands.InternationalizationPasteCommand; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; + +/** + * Offer a strategy for the internationalization of pasted objects. + */ +public class InternationalizationPasteStrategy extends AbstractPasteStrategy implements IPasteStrategy { + + /** + * The instance. + */ + private static IPasteStrategy instance = new InternationalizationPasteStrategy(); + + /** + * Constructor. + */ + public InternationalizationPasteStrategy() { + // Do nothing + } + + /** + * Gets the single instance of StereotypePasteStrategy. + * + * @return single instance of StereotypePasteStrategy + */ + public static IPasteStrategy getInstance() { + return instance; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getLabel() + */ + @Override + public String getLabel() { + return "Internationalization Strategy"; //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getDescription() + */ + @Override + public String getDescription() { + return "Copy Internationalization elements"; //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getID() + */ + @Override + public String getID() { + return new StringBuilder(Activator.ID).append(".InternationalizationStrategy").toString(); //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#dependsOn() + */ + @Override + public IPasteStrategy dependsOn() { + return DefaultPasteStrategy.getInstance(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getSemanticCommand(org.eclipse.emf.edit.domain.EditingDomain, org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard) + */ + @Override + public Command getSemanticCommand(final EditingDomain domain, final EObject targetOwner, final PapyrusClipboard<Object> papyrusClipboard) { + final CompoundCommand compoundCommand = new CompoundCommand("Internationalization paste objects"); //$NON-NLS-1$ + + Map<EObject, Object> sourceToCopy = papyrusClipboard.getSourceToInternalClipboard(); + + for (final Entry<EObject, Object> sourceToCopyEntry : sourceToCopy.entrySet()) { + final EObject source = sourceToCopyEntry.getKey(); + final EObject target = papyrusClipboard.getTragetCopyFromInternalClipboardCopy(sourceToCopyEntry.getValue()); + + final Set<Locale> localesForSource = LabelInternationalizationUtils.getAvailableLocales(source.eResource()); + + // Modify all the loaded properties files for copied object + for(final Locale currentLocale : localesForSource){ + final InternationalizationEntry internationalizationEntry = LabelInternationalizationUtils.getInternationalizationEntry(source, source, currentLocale); + if (null != internationalizationEntry) { + compoundCommand.append(new InternationalizationPasteCommand((TransactionalEditingDomain) domain, target, internationalizationEntry.getValue(), currentLocale)); + } + } + } + // An empty can't be executed + return !compoundCommand.getCommandList().isEmpty() ? compoundCommand : null; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java index fc1ac2cbd14..bab81f19644 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.ui.dialogs; @@ -24,6 +25,7 @@ import org.eclipse.papyrus.infra.widgets.validator.IntegerInputValidator; import org.eclipse.papyrus.infra.widgets.validator.RealInputValidator; import org.eclipse.papyrus.infra.widgets.validator.UnlimitedNaturalInputValidator; import org.eclipse.papyrus.uml.diagram.common.Messages; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ElementUtil; import org.eclipse.swt.widgets.Shell; import org.eclipse.uml2.common.util.UML2Util; @@ -307,13 +309,13 @@ public class PropertyEditors { if (property.getLower() > 0) { listOfChoice = new String[literals.size()]; for (int i = 0; i < listOfChoice.length; i++) { - listOfChoice[i] = literals.get(i).getName(); + listOfChoice[i] = UMLLabelInternationalization.getInstance().getLabel(literals.get(i)); } } else { listOfChoice = new String[literals.size() + 1]; listOfChoice[0] = ""; //$NON-NLS-1$ for (int i = 1; i < listOfChoice.length; i++) { - listOfChoice[i] = literals.get(i - 1).getName(); + listOfChoice[i] = UMLLabelInternationalization.getInstance().getLabel(literals.get(i - 1)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/ParameterLabelUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/ParameterLabelUtil.java index b18e1671a9f..a8bd0c6703b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/ParameterLabelUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/ParameterLabelUtil.java @@ -1,135 +1,136 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.util;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.uml.diagram.common.parser.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-public class ParameterLabelUtil {
-
- /** The String format for displaying a {@link Parameter} with direction */
- protected static final String DIRECTION_FORMAT = "%s %s";
-
- /** The String format for displaying a {@link Parameter} label with its name */
- protected static final String NAME_FORMAT = "%s%s";
-
- /** The String format for displaying a {@link Parameter} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /** The String format for displaying a {@link Parameter} label with its multiplicity */
- protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a {@link Parameter} label with its default value */
- protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
-
- /** The String format for displaying a {@link Parameter} label with its modifiers */
- protected static final String MODIFIER_FORMAT = "%s{%s}";
-
- public static String getPrintString(Parameter parameter, Collection<String> displayValue) {
- if (displayValue.isEmpty()) {
- return IMaskManagedSemanticParser.MaskedLabel;
- }
-
- String result = "";
-
- if (parameter != null) {
-
- // manage direction
- if (displayValue.contains(ICustomAppearance.DISP_DIRECTION) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) {
- String direction;
- switch (parameter.getDirection().getValue()) {
- case ParameterDirectionKind.IN:
- direction = "in";
- break;
- case ParameterDirectionKind.OUT:
- direction = "out";
- break;
- case ParameterDirectionKind.INOUT:
- direction = "inout";
- break;
- case ParameterDirectionKind.RETURN:
- direction = "return";
- break;
- default:
- direction = "in";
- break;
- }
- result = String.format(DIRECTION_FORMAT, direction, result);
- }
-
- // manage name
- if ((displayValue.contains(ICustomAppearance.DISP_NAME) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) && (parameter.isSetName())) {
- String name = parameter.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage type
- if (displayValue.contains(ICustomAppearance.DISP_TYPE) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
- String type = "<Undefined>";
- if (parameter.getType() != null) {
- type = parameter.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if (displayValue.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- String lower = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getLowerValue()) : "1";
- String upper = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getUpperValue()) : "1";
- if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY) || displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY)) && !("1".equals(lower) && "1".equals(upper))) {
- result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
- }
-
- // manage default value
- if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || displayValue.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = parameter.getDefaultValue();
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
-
- // manage modifier
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MODIFIERS) || displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
- StringBuffer sb = new StringBuffer();
- if (parameter.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if (parameter.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if (parameter.isStream()) {
- sb.append(sb.length() == 0 ? "stream" : ", stream");
- }
- if (parameter.isException()) {
- sb.append(sb.length() == 0 ? "exception" : ", exception");
- }
- if (sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
-
- }
- return result;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.util; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.diagram.common.parser.ILabelPreferenceConstants; +import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.ValueSpecification; + + +public class ParameterLabelUtil { + + /** The String format for displaying a {@link Parameter} with direction */ + protected static final String DIRECTION_FORMAT = "%s %s"; + + /** The String format for displaying a {@link Parameter} label with its name */ + protected static final String NAME_FORMAT = "%s%s"; + + /** The String format for displaying a {@link Parameter} label with its type */ + protected static final String TYPE_FORMAT = "%s: %s"; + + /** The String format for displaying a {@link Parameter} label with its multiplicity */ + protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]"; + + /** The String format for displaying a {@link Parameter} label with its default value */ + protected static final String DEFAULT_VALUE_FORMAT = "%s= %s"; + + /** The String format for displaying a {@link Parameter} label with its modifiers */ + protected static final String MODIFIER_FORMAT = "%s{%s}"; + + public static String getPrintString(Parameter parameter, Collection<String> displayValue) { + if (displayValue.isEmpty()) { + return IMaskManagedSemanticParser.MaskedLabel; + } + + String result = ""; + + if (parameter != null) { + + // manage direction + if (displayValue.contains(ICustomAppearance.DISP_DIRECTION) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) { + String direction; + switch (parameter.getDirection().getValue()) { + case ParameterDirectionKind.IN: + direction = "in"; + break; + case ParameterDirectionKind.OUT: + direction = "out"; + break; + case ParameterDirectionKind.INOUT: + direction = "inout"; + break; + case ParameterDirectionKind.RETURN: + direction = "return"; + break; + default: + direction = "in"; + break; + } + result = String.format(DIRECTION_FORMAT, direction, result); + } + + // manage name + if ((displayValue.contains(ICustomAppearance.DISP_NAME) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) && (parameter.isSetName())) { + String name = UMLLabelInternationalization.getInstance().getLabel(parameter); + result = String.format(NAME_FORMAT, result, name); + } + + // manage type + if (displayValue.contains(ICustomAppearance.DISP_TYPE) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { + String type = "<Undefined>"; + if (parameter.getType() != null) { + type = UMLLabelInternationalization.getInstance().getLabel(parameter.getType()); + } + + // If type is undefined only show "<Undefined>" when explicitly asked. + if (displayValue.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) { + result = String.format(TYPE_FORMAT, result, type); + } + } + + // manage multiplicity + String lower = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getLowerValue(), true) : "1"; + String upper = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getUpperValue(), true) : "1"; + if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY) || displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY)) && !("1".equals(lower) && "1".equals(upper))) { + result = String.format(MULTIPLICITY_FORMAT, result, lower, upper); + } + + // manage default value + if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || displayValue.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) { + ValueSpecification valueSpecification = parameter.getDefaultValue(); + result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification), true); + } + + // manage modifier + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MODIFIERS) || displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { + StringBuffer sb = new StringBuffer(); + if (parameter.isOrdered()) { + sb.append(sb.length() == 0 ? "ordered" : ", ordered"); + } + if (parameter.isUnique()) { + sb.append(sb.length() == 0 ? "unique" : ", unique"); + } + if (parameter.isStream()) { + sb.append(sb.length() == 0 ? "stream" : ", stream"); + } + if (parameter.isException()) { + sb.append(sb.length() == 0 ? "exception" : ", exception"); + } + if (sb.length() != 0) { + result = String.format(MODIFIER_FORMAT, result, sb.toString()); + } + } + + } + return result; + } + +}
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF index 26f714dbd47..5d5aba3231d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF @@ -40,7 +40,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-v org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)";visibility:=reexport, org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport, - org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport + org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/UmlCommunicationDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/UmlCommunicationDiagramForMultiEditor.java index 6240c937ff5..cd290a413a2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/UmlCommunicationDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/UmlCommunicationDiagramForMultiEditor.java @@ -1,159 +1,161 @@ -/*****************************************************************************
- * Copyright (c) 2009, 2014 LIFL, CEA LIST, and others.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin cedric.dumoulin@lifl.fr - Initial API and implementation
- * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Adapted from composite structure diagram
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.communication;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * <pre>
- * An editor to be used in multitabs editor.
- * This editor extends the original UMLDiagramEditor generated by GMF.
- * </pre>
- */
-public class UmlCommunicationDiagramForMultiEditor extends UMLDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Communication.gif"; //$NON-NLS-1$
-
- /**
- * The EditingDomain ID for this diagram
- */
- private static final String COMMUNICATION_DIAGRAM_EDITING_DOMAIN_ID = "org.eclipse.papyrus.uml.diagram.communication.EditingDomain"; //$NON-NLS-1$
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- *
- * Constructor. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @param servicesRegistry
- * @param diagram
- * @throws BackboneException
- * @throws ServiceException
- */
-
- public UmlCommunicationDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
-
- }
-
- /**
- * Returns an editing domain id used to retrive an editing domain from the
- * editing domain registry. Clients should override this if they wish to use
- * a shared editing domain for this editor. If null is returned then a new
- * editing domain will be created per editor instance.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID()
- *
- */
- @Override
- public String getEditingDomainID() {
- return COMMUNICATION_DIAGRAM_EDITING_DOMAIN_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- // Set name after calling super.init()
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // We are in a nested editor.
- // Provide an URI with fragment in order to reuse the same Resource
- // and to set the diagram to the fragment.
- // First, compute the URI
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- //System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")"); //$NON-NLS-1$
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening"; //$NON-NLS-1$
- String msg = "Cannot open input element:"; //$NON-NLS-1$
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009, 2014 LIFL, CEA LIST, and others. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin cedric.dumoulin@lifl.fr - Initial API and implementation + * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Adapted from composite structure diagram + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.communication; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + +/** + * <pre> + * An editor to be used in multitabs editor. + * This editor extends the original UMLDiagramEditor generated by GMF. + * </pre> + */ +public class UmlCommunicationDiagramForMultiEditor extends UMLDiagramEditor { + + /** + * The location of diagram icon in the plug-in + */ + private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Communication.gif"; //$NON-NLS-1$ + + /** + * The EditingDomain ID for this diagram + */ + private static final String COMMUNICATION_DIAGRAM_EDITING_DOMAIN_ID = "org.eclipse.papyrus.uml.diagram.communication.EditingDomain"; //$NON-NLS-1$ + + /** + * The image descriptor of the diagram icon + */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * + * Constructor. Context and required objects are retrieved from the + * ServiceRegistry. + * + * @param servicesRegistry + * @param diagram + * @throws BackboneException + * @throws ServiceException + */ + + public UmlCommunicationDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + + } + + /** + * Returns an editing domain id used to retrive an editing domain from the + * editing domain registry. Clients should override this if they wish to use + * a shared editing domain for this editor. If null is returned then a new + * editing domain will be created per editor instance. + * + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID() + * + */ + @Override + public String getEditingDomainID() { + return COMMUNICATION_DIAGRAM_EDITING_DOMAIN_ID; + } + + /** + * {@inheritDoc} + */ + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + /** + * + * {@inheritDoc} + */ + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + // Set name after calling super.init() + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + /** + * + * {@inheritDoc} + */ + @Override + public void setInput(IEditorInput input) { + try { + // We are in a nested editor. + // Provide an URI with fragment in order to reuse the same Resource + // and to set the diagram to the fragment. + // First, compute the URI + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + //System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")"); //$NON-NLS-1$ + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; //$NON-NLS-1$ + String msg = "Cannot open input element:"; //$NON-NLS-1$ + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/LifelineCustomParsers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/LifelineCustomParsers.java index 2a3be5c0d28..694c39a9ad6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/LifelineCustomParsers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/LifelineCustomParsers.java @@ -1,222 +1,225 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Adapted from sequence diagram
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.communication.custom.parser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Expression;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.LiteralSpecification;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.PartDecomposition;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for the Lifeline header. This parser of refreshing the text
- * displayed by the lifeline.
- */
-public class LifelineCustomParsers extends org.eclipse.papyrus.uml.diagram.communication.parsers.MessageFormatParser implements ISemanticParser {
-
- /**
- *
- * Constructor.
- *
- * @param features
- * @param editableFeatures
- */
- public LifelineCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- *
- * Constructor.
- *
- * @param features
- */
- public LifelineCustomParsers(EAttribute[] features) {
- super(features);
- }
-
- /**
- *
- * Constructor.
- *
- */
- public LifelineCustomParsers() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * Information identifying the lifeline displayed inside the rectangle
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
-
- if (obj instanceof Lifeline) {
- Lifeline lifeline = (Lifeline) obj;
- ConnectableElement connectableElement = lifeline.getRepresents();
- ValueSpecification selector = lifeline.getSelector();
-
- if (connectableElement != null) {
- // Add ConnectableElement Name
- String connectableElementName = connectableElement.getName();
- if (connectableElementName != null) {
- sb.append(connectableElementName);
- }
-
- // Add the selector if it is a LiteralSpecification
- if (selector instanceof LiteralSpecification) {
- sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector)).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Add the type name
- Type type = connectableElement.getType();
- if (type != null && type.getName() != null && type.getName().length() > 0) {
- sb.append(" : ").append(type.getName()); //$NON-NLS-1$
- }
- }
-
- // Add the selector if it is an Expression
- if (selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) {
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector);
- if (specificationValue != null && specificationValue.length() > 0) {
- sb.append("\n").append(specificationValue); //$NON-NLS-1$
- }
- }
-
- // Add the decomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if (partDecomposition != null) {
- Interaction refersTo = partDecomposition.getRefersTo();
- if (refersTo != null) {
- sb.append("\nref ").append(refersTo.getName()); //$NON-NLS-1$
- }
- }
-
- // LifelineIndent cannot be empty so if the stringBuffer is empty we
- // add the name of the
- // lifeline
- // This case occurs when creating the lifeline for example
- if (sb.length() == 0) {
- sb.append(lifeline.getName());
- }
- }
-
- return sb.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
- * java.lang.Object)
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
- * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
- */
- @SuppressWarnings("rawtypes")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Lifeline) {
- Lifeline lifeline = (Lifeline) element;
-
- // Add the lifeline
- semanticElementsBeingParsed.add(lifeline);
- // Add the selector
- if (lifeline.getSelector() != null) {
- semanticElementsBeingParsed.add(lifeline.getSelector());
- }
-
- // Add the partDecomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if (partDecomposition != null) {
- semanticElementsBeingParsed.add(partDecomposition);
- // Add the Interaction refered by the partDecomposition
- if (partDecomposition.getRefersTo() != null) {
- semanticElementsBeingParsed.add(partDecomposition.getRefersTo());
- }
- }
-
- // Add the connectableElement and its type if it has any
- ConnectableElement connectableElement = lifeline.getRepresents();
- if (connectableElement != null) {
- semanticElementsBeingParsed.add(connectableElement);
- if (connectableElement.getType() != null) {
- semanticElementsBeingParsed.add(connectableElement.getType());
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this
- * parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(feature)
- || UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralBoolean_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature)
- || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Selector().equals(feature) || UMLPackage.eINSTANCE.getLifeline_DecomposedAs().equals(feature)
- || UMLPackage.eINSTANCE.getLifeline_Represents().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Adapted from sequence diagram + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.communication.custom.parser; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.ConnectableElement; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Expression; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.LiteralSpecification; +import org.eclipse.uml2.uml.OpaqueExpression; +import org.eclipse.uml2.uml.PartDecomposition; +import org.eclipse.uml2.uml.TimeExpression; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * A specific parser for the Lifeline header. This parser of refreshing the text + * displayed by the lifeline. + */ +public class LifelineCustomParsers extends org.eclipse.papyrus.uml.diagram.communication.parsers.MessageFormatParser implements ISemanticParser { + + /** + * + * Constructor. + * + * @param features + * @param editableFeatures + */ + public LifelineCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * + * Constructor. + * + * @param features + */ + public LifelineCustomParsers(EAttribute[] features) { + super(features); + } + + /** + * + * Constructor. + * + */ + public LifelineCustomParsers() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * Information identifying the lifeline displayed inside the rectangle + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + StringBuffer sb = new StringBuffer(); + + if (obj instanceof Lifeline) { + Lifeline lifeline = (Lifeline) obj; + ConnectableElement connectableElement = lifeline.getRepresents(); + ValueSpecification selector = lifeline.getSelector(); + + if (connectableElement != null) { + // Add ConnectableElement Name + String connectableElementName = UMLLabelInternationalization.getInstance().getLabel(connectableElement); + if (connectableElementName != null) { + sb.append(connectableElementName); + } + + // Add the selector if it is a LiteralSpecification + if (selector instanceof LiteralSpecification) { + sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector, true)).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // Add the type name + Type type = connectableElement.getType(); + if (type != null && type.getName() != null && type.getName().length() > 0) { + sb.append(" : ").append(UMLLabelInternationalization.getInstance().getLabel(type)); //$NON-NLS-1$ + } + } + + // Add the selector if it is an Expression + if (selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) { + String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector, true); + if (specificationValue != null && specificationValue.length() > 0) { + sb.append("\n").append(specificationValue); //$NON-NLS-1$ + } + } + + // Add the decomposition + PartDecomposition partDecomposition = lifeline.getDecomposedAs(); + if (partDecomposition != null) { + Interaction refersTo = partDecomposition.getRefersTo(); + if (refersTo != null) { + sb.append("\nref ").append(UMLLabelInternationalization.getInstance().getLabel(refersTo)); //$NON-NLS-1$ + } + } + + // LifelineIndent cannot be empty so if the stringBuffer is empty we + // add the name of the + // lifeline + // This case occurs when creating the lifeline for example + if (sb.length() == 0) { + sb.append(UMLLabelInternationalization.getInstance().getLabel(lifeline)); + } + } + + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @seeorg.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * areSemanticElementsAffected (org.eclipse.emf.ecore.EObject, + * java.lang.Object) + */ + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @seeorg.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser# + * getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject) + */ + @SuppressWarnings("rawtypes") + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Lifeline) { + Lifeline lifeline = (Lifeline) element; + + // Add the lifeline + semanticElementsBeingParsed.add(lifeline); + // Add the selector + if (lifeline.getSelector() != null) { + semanticElementsBeingParsed.add(lifeline.getSelector()); + } + + // Add the partDecomposition + PartDecomposition partDecomposition = lifeline.getDecomposedAs(); + if (partDecomposition != null) { + semanticElementsBeingParsed.add(partDecomposition); + // Add the Interaction refered by the partDecomposition + if (partDecomposition.getRefersTo() != null) { + semanticElementsBeingParsed.add(partDecomposition.getRefersTo()); + } + } + + // Add the connectableElement and its type if it has any + ConnectableElement connectableElement = lifeline.getRepresents(); + if (connectableElement != null) { + semanticElementsBeingParsed.add(connectableElement); + if (connectableElement.getType() != null) { + semanticElementsBeingParsed.add(connectableElement.getType()); + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this + * parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(feature) + || UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralBoolean_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) + || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Selector().equals(feature) || UMLPackage.eINSTANCE.getLifeline_DecomposedAs().equals(feature) + || UMLPackage.eINSTANCE.getLifeline_Represents().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/MessageParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/MessageParser.java index 24040c22913..5bbf47ab6a6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/MessageParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/parser/MessageParser.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation + * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.communication.custom.parser; @@ -20,6 +21,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.papyrus.uml.diagram.communication.custom.messages.Messages; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Message; /** @@ -77,9 +79,9 @@ public class MessageParser implements IParser { // message.getEAnnotations().get(0).getDetails().get(0).getValue() // + ":" + message.getName(); // else - result = message.getName(); + result = UMLLabelInternationalization.getInstance().getLabel(message); } else { - result = message.getName(); + result = UMLLabelInternationalization.getInstance().getLabel(message); } // result = "1:" + result; return result; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/parsers/MessageFormatParser.java index f2cfb77fcfc..b121b9d0717 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/parsers/MessageFormatParser.java @@ -7,7 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.communication.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.communication.part.Messages; import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -204,4 +212,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF index b9140f43113..748a1e9fc6f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF @@ -25,7 +25,9 @@ Require-Bundle: org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0) org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport, org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.diagram.menu;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.diagram.menu;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 2.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/UmlComponentDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/UmlComponentDiagramForMultiEditor.java index ff71fde0d3d..46b76b35585 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/UmlComponentDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/UmlComponentDiagramForMultiEditor.java @@ -1,163 +1,165 @@ -/*****************************************************************************
- * Copyright (c) 2011, 2014 CEA LIST and others.
- *
- *
- * 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:
- * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.El-Kouhen@lifl.fr
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.component;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-
-/**
- * The Class UmlComponentDiagramForMultiEditor.
- */
-public class UmlComponentDiagramForMultiEditor extends UMLDiagramEditor {
-
- /** The location of diagram icon in the plug-in. */
- private static final String DIAG_IMG_PATH = "icons/obj16/ComponentDiagram.gif"; //$NON-NLS-1$
-
- /** The image descriptor of the diagram icon. */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlComponentDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @param servicesRegistry
- * the services registry
- * @param diagram
- * the diagram
- * @throws BackboneException
- * the backbone exception
- * @throws ServiceException
- * the service exception
- */
- public UmlComponentDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
-
- /**
- * Inits the.
- *
- * @param site
- * the site
- * @param input
- * the input
- * @throws PartInitException
- * the part init exception
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
-
- /**
- * Sets the input.
- *
- * @param input
- * the new input
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#setInput(org.eclipse.ui.IEditorInput)
- */
-
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
-
- /**
- * Creates the graphical viewer.
- *
- * @param parent
- * the parent
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#createGraphicalViewer(org.eclipse.swt.widgets.Composite)
- */
-
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
-
- /**
- * Sets the focus.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette#setFocus()
- */
-
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * Gets the editing domain id.
- *
- * @return the editing domain id
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID()
- */
-
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.component.EditingDomain";
- }
-}
+/***************************************************************************** + * Copyright (c) 2011, 2014 CEA LIST and others. + * + * + * 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: + * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.El-Kouhen@lifl.fr + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.component; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + + +/** + * The Class UmlComponentDiagramForMultiEditor. + */ +public class UmlComponentDiagramForMultiEditor extends UMLDiagramEditor { + + /** The location of diagram icon in the plug-in. */ + private static final String DIAG_IMG_PATH = "icons/obj16/ComponentDiagram.gif"; //$NON-NLS-1$ + + /** The image descriptor of the diagram icon. */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlComponentDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the + * ServiceRegistry. + * + * @param servicesRegistry + * the services registry + * @param diagram + * the diagram + * @throws BackboneException + * the backbone exception + * @throws ServiceException + * the service exception + */ + public UmlComponentDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + } + + + /** + * Inits the. + * + * @param site + * the site + * @param input + * the input + * @throws PartInitException + * the part init exception + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) + */ + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + + /** + * Sets the input. + * + * @param input + * the new input + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#setInput(org.eclipse.ui.IEditorInput) + */ + + @Override + public void setInput(IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; + String msg = "Cannot open input element:"; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + + /** + * Creates the graphical viewer. + * + * @param parent + * the parent + * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#createGraphicalViewer(org.eclipse.swt.widgets.Composite) + */ + + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + + /** + * Sets the focus. + * + * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette#setFocus() + */ + + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + + /** + * Gets the editing domain id. + * + * @return the editing domain id + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID() + */ + + @Override + public String getEditingDomainID() { + return "org.eclipse.papyrus.uml.diagram.component.EditingDomain"; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java index 4670c394ddc..53fae4b18bb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java @@ -1,211 +1,259 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.component.part.Messages;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
-
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(
- getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(
- getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0))
- .toString();
- }
-
- /**
- * @generated
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE,
- NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + */ +package org.eclipse.papyrus.uml.diagram.component.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.component.part.Messages; +import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + @Override + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + @Override + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat( + getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + @Override + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat( + getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + @Override + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)) + .toString(); + } + + /** + * @generated + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, + NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + @Override + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF index 9ec08f2eaaf..de91b58aa4b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF @@ -44,7 +44,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version= org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)";visibility:=reexport, org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/UmlCompositeDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/UmlCompositeDiagramForMultiEditor.java index 9e57d166a9d..e1b374deafb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/UmlCompositeDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/UmlCompositeDiagramForMultiEditor.java @@ -10,6 +10,7 @@ * Contributors: * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -24,6 +25,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditor; import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; import org.eclipse.swt.graphics.Image; @@ -78,7 +80,7 @@ public class UmlCompositeDiagramForMultiEditor extends UMLDiagramEditor { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartFromTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartFromTypeCreateCommand.java index eac6ac42901..f3ec4ac4b93 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartFromTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartFromTypeCreateCommand.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command; @@ -21,7 +22,9 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.gmfdiag.common.adapter.SemanticAdapter; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.StructuredClassifier; import org.eclipse.uml2.uml.Type; @@ -73,21 +76,37 @@ public class PropertyPartFromTypeCreateCommand extends EditElementCommand { StructuredClassifier owner = (StructuredClassifier) getElementToEdit(); owner.getOwnedAttributes().add(newElement); newElement.setType(type); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + semanticAdapter.setElement(newElement); String typeName = type.getName(); String elementName = (typeName.length() == 0) ? "none" : //$NON-NLS-1$ typeName.substring(0, 1).toLowerCase() + typeName.substring(1); + + String typeLabel = ""; + String elementLabel = ""; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(type) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(type)) { + typeLabel = UMLLabelInternationalization.getInstance().getLabelWithoutUML(type); + elementLabel = (typeLabel.length() == 0) ? "none" : //$NON-NLS-1$ + typeLabel.substring(0, 1).toLowerCase() + typeLabel.substring(1); + } + int i = 0; String initialElementName = elementName; + String initialElementLabel = elementLabel; // assure that name is unique. while (owner.getAttribute(elementName, null) != null) { elementName = initialElementName + String.valueOf(i); + if(!elementLabel.isEmpty()){ + elementLabel = initialElementLabel + String.valueOf(i); + } i++; } newElement.setName(elementName); - ((CreateElementRequest) getRequest()).setNewElement(newElement); + if(!elementName.isEmpty()){ + UMLLabelInternationalization.getInstance().setLabel(newElement, elementName, null); + } - semanticAdapter.setElement(newElement); return CommandResult.newOKCommandResult(semanticAdapter); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/InformationFlowCustomLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/InformationFlowCustomLabelEditPolicy.java index daa5986fe91..74ec96c07e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/InformationFlowCustomLabelEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/InformationFlowCustomLabelEditPolicy.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -18,6 +19,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.InformationFlowConveyedLabelEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.InformationFlow; @@ -134,7 +136,7 @@ public class InformationFlowCustomLabelEditPolicy extends AbstractCustomLabelEdi if (getUMLElement() instanceof InformationFlow) { EList<Classifier> classes = ((InformationFlow) getUMLElement()).getConveyeds(); for (int i = 0; i < classes.size(); i++) { - name += classes.get(i).getName(); + name += UMLLabelInternationalization.getInstance().getLabel(classes.get(i)); if (i != classes.size() - 1) { name += ", "; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/ConnectorLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/ConnectorLabelParser.java index e2632e3c771..216fa87a8a8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/ConnectorLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/ConnectorLabelParser.java @@ -1,96 +1,98 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.parsers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link Connector} label
- */
-public class ConnectorLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a {@link Connector} label with its type (Association) */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- EObject eObject = EMFHelper.getEObject(element);
-
- if ((eObject != null) && (eObject instanceof Connector)) {
-
- Connector connector = (Connector) eObject;
-
- // manage name
- if (connector.isSetName()) {
- result = connector.getName();
- }
-
- // manage type
- String type = "";
- if ((connector.getType() != null) && (connector.getType().isSetName())) {
- type = connector.getType().getName();
- result = String.format(TYPE_FORMAT, result, type);
- }
-
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if (event instanceof Notification) {
- Object feature = ((Notification) event).getFeature();
- if (feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConnector_Type().equals(feature);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if ((element != null) && (element instanceof Connector)) {
- Connector semElement = (Connector) element;
-
- semanticElementsBeingParsed.add(semElement);
- if (semElement.getType() != null) {
- semanticElementsBeingParsed.add(semElement.getType());
- }
- }
- return semanticElementsBeingParsed;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.parsers; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Connector; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Semantic Parser for {@link Connector} label + */ +public class ConnectorLabelParser extends NamedElementLabelParser { + + /** The String format for displaying a {@link Connector} label with its type (Association) */ + protected static final String TYPE_FORMAT = "%s: %s"; + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String result = ""; + EObject eObject = EMFHelper.getEObject(element); + + if ((eObject != null) && (eObject instanceof Connector)) { + + Connector connector = (Connector) eObject; + + // manage name + if (connector.isSetName()) { + result = UMLLabelInternationalization.getInstance().getLabel(connector); + } + + // manage type + String type = ""; + if ((connector.getType() != null) && (connector.getType().isSetName())) { + type = UMLLabelInternationalization.getInstance().getLabel(connector.getType()); + result = String.format(TYPE_FORMAT, result, type); + } + + } + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + + if (event instanceof Notification) { + Object feature = ((Notification) event).getFeature(); + if (feature instanceof EStructuralFeature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConnector_Type().equals(feature); + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public List<EObject> getSemanticElementsBeingParsed(EObject element) { + List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); + + if ((element != null) && (element instanceof Connector)) { + Connector semElement = (Connector) element; + + semanticElementsBeingParsed.add(semElement); + if (semElement.getType() != null) { + semanticElementsBeingParsed.add(semElement.getType()); + } + } + return semanticElementsBeingParsed; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java index 90401f8312c..bfc9de47a96 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java @@ -1,147 +1,157 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.parsers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link NamedElement} name.
- */
-public class NamedElementLabelParser implements ISemanticParser {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable element, int flags) {
- String editString = "";
-
- EObject eObject = EMFHelper.getEObject(element);
- if ((eObject != null) && (eObject instanceof NamedElement)) {
- NamedElement semElement = (NamedElement) eObject;
- if (semElement.isSetName()) {
- editString = semElement.getName();
- }
- }
- return editString;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
-
- ICommand command = UnexecutableCommand.INSTANCE;
-
- EObject objectToEdit = EMFHelper.getEObject(element);
- if (objectToEdit == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- try {
- command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString));
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
-
- return command;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- EObject eObject = EMFHelper.getEObject(element);
-
- if (eObject instanceof NamedElement) {
- return ((NamedElement) eObject).getName();
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if (event instanceof Notification) {
- Object feature = ((Notification) event).getFeature();
- if (feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
- semanticElementsBeingParsed.add(element);
-
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009-2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.composite.custom.parsers; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Semantic Parser for {@link NamedElement} name. + */ +public class NamedElementLabelParser implements ISemanticParser { + + /** + * {@inheritDoc} + */ + @Override + public String getEditString(IAdaptable element, int flags) { + String editString = ""; + + EObject eObject = EMFHelper.getEObject(element); + if ((eObject != null) && (eObject instanceof NamedElement)) { + NamedElement semElement = (NamedElement) eObject; + if (semElement.isSetName()) { + editString = UMLLabelInternationalization.getInstance().getLabel(semElement); + } + } + return editString; + } + + /** + * {@inheritDoc} + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable element, String editString) { + return ParserEditStatus.EDITABLE_STATUS; + } + + /** + * {@inheritDoc} + */ + @Override + public ICommand getParseCommand(IAdaptable element, String newString, int flags) { + + ICommand command = UnexecutableCommand.INSTANCE; + + EObject objectToEdit = EMFHelper.getEObject(element); + if (objectToEdit == null) { + return UnexecutableCommand.INSTANCE; + } + + try { + if(InternationalizationPreferencesUtils.getInternationalizationPreference(objectToEdit) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)objectToEdit)){ + final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); + }else{ + command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + } + } catch (ServiceException e) { + Activator.log.error(e); + } + + return command; + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + String result = ""; + EObject eObject = EMFHelper.getEObject(element); + + if (eObject instanceof NamedElement) { + return UMLLabelInternationalization.getInstance().getLabel((NamedElement) eObject); + } + + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + + if (event instanceof Notification) { + Object feature = ((Notification) event).getFeature(); + if (feature instanceof EStructuralFeature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature); + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public List<EObject> getSemanticElementsBeingParsed(EObject element) { + List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); + semanticElementsBeingParsed.add(element); + + return semanticElementsBeingParsed; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + return true; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/RoleBindingRoleNameParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/RoleBindingRoleNameParser.java index 8f8e13f8ba5..c61cace6799 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/RoleBindingRoleNameParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/RoleBindingRoleNameParser.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.composite.custom.parsers; @@ -26,6 +27,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.ConnectableElement; import org.eclipse.uml2.uml.Dependency; import org.eclipse.uml2.uml.NamedElement; @@ -122,7 +124,7 @@ public class RoleBindingRoleNameParser implements ISemanticParser { if (!binding.getClients().isEmpty()) { NamedElement role = binding.getClients().get(0); - return role.getName(); + return UMLLabelInternationalization.getInstance().getLabel(role); } // else return ""; //$NON-NLS-1$ } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src-gen/org/eclipse/papyrus/uml/diagram/composite/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src-gen/org/eclipse/papyrus/uml/diagram/composite/parsers/MessageFormatParser.java index c4740a9dc46..b74e1768c2c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src-gen/org/eclipse/papyrus/uml/diagram/composite/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src-gen/org/eclipse/papyrus/uml/diagram/composite/parsers/MessageFormatParser.java @@ -1,204 +1,252 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.composite.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.composite.part.Messages;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(
- getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(
- getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0))
- .toString();
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE,
- NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + */ +package org.eclipse.papyrus.uml.diagram.composite.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.composite.part.Messages; +import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat( + getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat( + getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)) + .toString(); + } + + /** + * @generated + */ + public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, + NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF index fde9fdfe305..561a4d0e6fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF @@ -1,70 +1,72 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
- org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
- org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
- org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
- org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
- org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
- org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.expressions,
- org.eclipse.papyrus.uml.diagram.deployment.parsers,
- org.eclipse.papyrus.uml.diagram.deployment.part,
- org.eclipse.papyrus.uml.diagram.deployment.preferences,
- org.eclipse.papyrus.uml.diagram.deployment.providers,
- org.eclipse.papyrus.uml.diagram.deployment.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.infra.widgets,
- org.eclipse.papyrus.infra.ui,
- org.eclipse.papyrus.infra.core.sashwindows.di,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
- org.eclipse.uml2.uml;visibility:=reexport,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.gmf.tooling.runtime;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors,
- org.eclipse.papyrus.infra.services.edit
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 3.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.deployment, + org.eclipse.papyrus.uml.diagram.deployment.custom.actions, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic, + org.eclipse.papyrus.uml.diagram.deployment.custom.factory, + org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes, + org.eclipse.papyrus.uml.diagram.deployment.custom.messages, + org.eclipse.papyrus.uml.diagram.deployment.custom.providers, + org.eclipse.papyrus.uml.diagram.deployment.edit.helpers, + org.eclipse.papyrus.uml.diagram.deployment.edit.parts, + org.eclipse.papyrus.uml.diagram.deployment.edit.policies, + org.eclipse.papyrus.uml.diagram.deployment.expressions, + org.eclipse.papyrus.uml.diagram.deployment.parsers, + org.eclipse.papyrus.uml.diagram.deployment.part, + org.eclipse.papyrus.uml.diagram.deployment.preferences, + org.eclipse.papyrus.uml.diagram.deployment.providers, + org.eclipse.papyrus.uml.diagram.deployment.sheet +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)", + org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)", + org.eclipse.papyrus.infra.gmfdiag.preferences;visibility:=reexport;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)", + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.jface, + org.eclipse.ui.ide, + org.eclipse.ui.views, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.emf.edit.ui, + org.eclipse.gmf.runtime.emf.core, + org.eclipse.gmf.runtime.emf.commands.core, + org.eclipse.gmf.runtime.emf.ui.properties, + org.eclipse.gmf.runtime.diagram.ui, + org.eclipse.papyrus.uml.diagram.common, + org.eclipse.papyrus.infra.gmfdiag.common, + org.eclipse.papyrus.infra.widgets, + org.eclipse.papyrus.infra.ui, + org.eclipse.papyrus.infra.core.sashwindows.di, + org.eclipse.gmf.runtime.diagram.ui.properties, + org.eclipse.gmf.runtime.diagram.ui.providers, + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.draw2d;visibility:=reexport, + org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport, + org.eclipse.uml2.uml;visibility:=reexport, + org.eclipse.uml2.uml.edit;visibility:=reexport, + org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.emf.ecore.edit;visibility:=reexport, + org.eclipse.emf.validation;visibility:=reexport, + org.eclipse.gmf.tooling.runtime;visibility:=reexport, + org.eclipse.gef, + org.eclipse.papyrus.extensionpoints.editors, + org.eclipse.papyrus.infra.services.edit, + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" +Bundle-Vendor: %providerName +Eclipse-LazyStart: true +Bundle-Version: 3.0.0.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/UmlDeploymentDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/UmlDeploymentDiagramForMultiEditor.java index 97990e212c8..efabeaf0387 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/UmlDeploymentDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/UmlDeploymentDiagramForMultiEditor.java @@ -1,160 +1,162 @@ -/*****************************************************************************
- * Copyright (c) 2011, 2014 CEA LIST and others.
- *
- *
- * 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:
- * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.El-Kouhen@lifl.fr
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.osgi.framework.ServiceException;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class UmlDeploymentDiagramForMultiEditor.
- */
-public class UmlDeploymentDiagramForMultiEditor extends UMLDiagramEditor {
-
- /** The location of diagram icon in the plug-in. */
- private static final String DIAG_IMG_PATH = "icons/obj16/DeploymentDiagram.gif";
-
- /** The image descriptor of the diagram icon. */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDeploymentDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the ServiceRegistry.
- *
- * @param servicesRegistry
- * the services registry
- * @param diagram
- * the diagram
- * @throws BackboneException
- * the backbone exception
- * @throws ServiceException
- * the service exception
- * @throws ServiceException
- * the service exception
- */
- public UmlDeploymentDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException, org.eclipse.papyrus.infra.core.services.ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * Inits the.
- *
- * @param site
- * the site
- * @param input
- * the input
- * @throws PartInitException
- * the part init exception
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
- /**
- * Sets the input.
- *
- * @param input
- * the new input
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#setInput(org.eclipse.ui.IEditorInput)
- */
-
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * Creates the graphical viewer.
- *
- * @param parent
- * the parent
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#createGraphicalViewer(org.eclipse.swt.widgets.Composite)
- */
-
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * Sets the focus.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette#setFocus()
- */
-
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * Gets the editing domain id.
- *
- * @return the editing domain id
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID()
- */
-
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.deployment.EditingDomain";
- }
-}
+/***************************************************************************** + * Copyright (c) 2011, 2014 CEA LIST and others. + * + * + * 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: + * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.El-Kouhen@lifl.fr + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.osgi.framework.ServiceException; + +// TODO: Auto-generated Javadoc +/** + * The Class UmlDeploymentDiagramForMultiEditor. + */ +public class UmlDeploymentDiagramForMultiEditor extends UMLDiagramEditor { + + /** The location of diagram icon in the plug-in. */ + private static final String DIAG_IMG_PATH = "icons/obj16/DeploymentDiagram.gif"; + + /** The image descriptor of the diagram icon. */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDeploymentDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the ServiceRegistry. + * + * @param servicesRegistry + * the services registry + * @param diagram + * the diagram + * @throws BackboneException + * the backbone exception + * @throws ServiceException + * the service exception + * @throws ServiceException + * the service exception + */ + public UmlDeploymentDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException, org.eclipse.papyrus.infra.core.services.ServiceException { + super(servicesRegistry, diagram); + } + + /** + * Inits the. + * + * @param site + * the site + * @param input + * the input + * @throws PartInitException + * the part init exception + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) + */ + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + /** + * Sets the input. + * + * @param input + * the new input + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#setInput(org.eclipse.ui.IEditorInput) + */ + + @Override + public void setInput(IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; + String msg = "Cannot open input element:"; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + /** + * Creates the graphical viewer. + * + * @param parent + * the parent + * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#createGraphicalViewer(org.eclipse.swt.widgets.Composite) + */ + + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + /** + * Sets the focus. + * + * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette#setFocus() + */ + + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + + /** + * Gets the editing domain id. + * + * @return the editing domain id + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID() + */ + + @Override + public String getEditingDomainID() { + return "org.eclipse.papyrus.uml.diagram.deployment.EditingDomain"; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src-gen/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src-gen/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java index 25e9619e3a3..81155e942cb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src-gen/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src-gen/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java @@ -1,212 +1,260 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
-
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(
- UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE,
- NLS.bind(
- Messages.MessageFormatParser_InvalidInputError,
- new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + */ +package org.eclipse.papyrus.uml.diagram.deployment.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.deployment.part.Messages; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + @Override + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + @Override + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + @Override + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + @Override + public String getEditString(IAdaptable adapter, int flags) { + EObject element = adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * @generated + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus( + UMLDiagramEditorPlugin.ID, + IParserEditStatus.UNEDITABLE, + NLS.bind( + Messages.MessageFormatParser_InvalidInputError, + new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + @Override + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF index d0904e72257..9e0d7889a64 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF @@ -24,7 +24,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1. org.eclipse.papyrus.uml.diagram.communication;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramForMultiEditor.java index aba639a5d9a..cea592e175e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramForMultiEditor.java @@ -11,6 +11,7 @@ * * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.interactionoverview; @@ -24,6 +25,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.interactionoverview.part.InteractionOverviewDiagramEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -72,7 +74,7 @@ public class InteractionOverviewDiagramForMultiEditor extends InteractionOvervie @Override public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/AddHyperlinkDiagram.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/AddHyperlinkDiagram.java index d3acc21b6cc..f08cf0ad795 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/AddHyperlinkDiagram.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/AddHyperlinkDiagram.java @@ -7,6 +7,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands; @@ -23,6 +26,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.hyperlink.helper.EditorHyperLinkHelper; import org.eclipse.papyrus.infra.gmfdiag.hyperlink.object.HyperLinkEditor; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.interactionoverview.part.Messages; public class AddHyperlinkDiagram extends AbstractTransactionalCommand { @@ -47,7 +51,7 @@ public class AddHyperlinkDiagram extends AbstractTransactionalCommand { HyperLinkEditor hyperLinkEditor = new HyperLinkEditor(); hyperLinkEditor.setObject(diagram); hyperLinkEditor.setIsDefault(true); - hyperLinkEditor.setTooltipText(diagram.getName()); + hyperLinkEditor.setTooltipText(LabelInternationalization.getInstance().getDiagramLabel(diagram)); EditorHyperLinkHelper helper = new EditorHyperLinkHelper(); RecordingCommand command = helper.getAddHyperLinkCommand(getEditingDomain(), callBehaviorView, hyperLinkEditor); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/parser/CustomCallBehaviorActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/parser/CustomCallBehaviorActionParser.java index 3c81981bb66..88a1d648bb5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/parser/CustomCallBehaviorActionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/parser/CustomCallBehaviorActionParser.java @@ -1,88 +1,92 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.parser;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.diagram.activity.parser.custom.CallBehaviorActionParser;
-import org.eclipse.uml2.uml.CallBehaviorAction;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class CustomCallBehaviorActionParser extends CallBehaviorActionParser {
-
- public static final String DEFAULT_VALUE = "";
-
- public CustomCallBehaviorActionParser() {
- super(new EAttribute[] {});
- }
-
- @Override
- public String getPrintString(final IAdaptable element, final int flags) {
- final Object obj = EMFHelper.getEObject(element);
- if (obj instanceof CallBehaviorAction) {
- final CallBehaviorAction action = (CallBehaviorAction) obj;
- String actionName = action.getName();
- if (hasContent(actionName)) {
- return actionName;
- }
-
- String behaviorName = null;
- if (action.getBehavior() != null) {
- behaviorName = action.getBehavior().getName();
- }
-
- if (hasContent(behaviorName)) {
- return behaviorName;
- }
- }
- return DEFAULT_VALUE;
- }
-
- @Override
- public String getEditString(final IAdaptable element, final int flags) {
- final Object obj = EMFHelper.getEObject(element);
- if (obj instanceof CallBehaviorAction) {
- final CallBehaviorAction action = (CallBehaviorAction) obj;
- String actionName = action.getName();
- if (hasContent(actionName)) {
- return actionName;
- }
- }
- return DEFAULT_VALUE;
- }
-
- /**
- * @return false if str == null or str is empty
- */
- private boolean hasContent(String str) {
- return str != null && str.length() != 0;
- }
-
- @Override
- public ICommand getParseCommand(final IAdaptable adapter, final String newString, final int flags) {
- if (newString == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final EObject element = EMFHelper.getEObject(adapter);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- return super.getModificationCommand(element, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.interactionoverview.parser; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.diagram.activity.parser.custom.CallBehaviorActionParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CallBehaviorAction; +import org.eclipse.uml2.uml.UMLPackage; + +public class CustomCallBehaviorActionParser extends CallBehaviorActionParser { + + public static final String DEFAULT_VALUE = ""; + + public CustomCallBehaviorActionParser() { + super(new EAttribute[] {}); + } + + @Override + public String getPrintString(final IAdaptable element, final int flags) { + final Object obj = EMFHelper.getEObject(element); + if (obj instanceof CallBehaviorAction) { + final CallBehaviorAction action = (CallBehaviorAction) obj; + String actionName = UMLLabelInternationalization.getInstance().getLabel(action); + if (hasContent(actionName)) { + return actionName; + } + + String behaviorName = null; + if (action.getBehavior() != null) { + behaviorName = UMLLabelInternationalization.getInstance().getLabel(action.getBehavior()); + } + + if (hasContent(behaviorName)) { + return behaviorName; + } + } + return DEFAULT_VALUE; + } + + @Override + public String getEditString(final IAdaptable element, final int flags) { + final Object obj = EMFHelper.getEObject(element); + if (obj instanceof CallBehaviorAction) { + final CallBehaviorAction action = (CallBehaviorAction) obj; + String actionName = UMLLabelInternationalization.getInstance().getLabel(action); + if (hasContent(actionName)) { + return actionName; + } + } + return DEFAULT_VALUE; + } + + /** + * @return false if str == null or str is empty + */ + private boolean hasContent(String str) { + return str != null && str.length() != 0; + } + + @Override + public ICommand getParseCommand(final IAdaptable adapter, final String newString, final int flags) { + if (newString == null) { + return UnexecutableCommand.INSTANCE; + } + final EObject element = EMFHelper.getEObject(adapter); + final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + + return super.getModificationCommand(element, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF index 9acd3513764..6b481063838 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF @@ -39,7 +39,9 @@ Require-Bundle: org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)", org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)", org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)", - org.eclipse.papyrus.uml.service.types.ui;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.service.types.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/UmlProfileDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/UmlProfileDiagramForMultiEditor.java index 3bb38faf807..eb49db5e0d3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/UmlProfileDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/UmlProfileDiagramForMultiEditor.java @@ -1,163 +1,165 @@ -/*****************************************************************************
- * Copyright (c) 2009, 2014 LIFL, CEA LIST, and others.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin cedric.dumoulin@lifl.fr - Initial API and implementation
- * Yann Tanguy yann.tanguy@cea.fr - Adapted from Class Diagram
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Adapted from composite structure diagram
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.profile;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.l10n.EditorMessages;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * <pre>
- * An editor to be used in multitabs editor.
- * This editor extends the original UMLDiagramEditor generated by GMF.
- * </pre>
- */
-public class UmlProfileDiagramForMultiEditor extends UMLDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Profile.gif"; //$NON-NLS-1$
-
- /**
- * The EditingDomain ID for this diagram
- */
- private static final String PROFIL_DIAGRAM_EDITING_DOMAIN_ID = "org.eclipse.papyrus.uml.diagram.profile.EditingDomain"; //$NON-NLS-1$
-
-
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor. Context and required objects are retrieved from the ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public UmlProfileDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
-
- }
-
- /**
- * Returns an editing domain id used to retrive an editing domain from the editing domain
- * registry. Clients should override this if they wish to use a shared editing domain for this
- * editor. If null is returned then a new editing domain will be created per editor instance.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID()
- *
- */
- @Override
- public String getEditingDomainID() {
- return PROFIL_DIAGRAM_EDITING_DOMAIN_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
-
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- // Set name after calling super.init()
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
-
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // We are in a nested editor.
- // Provide an URI with fragment in order to reuse the same Resource
- // and to set the diagram to the fragment.
- // First, compute the URI
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- //System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")"); //$NON-NLS-1$
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = EditorMessages.Editor_error_setinput_title;
- String msg = EditorMessages.Editor_error_setinput_message;
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
-
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009, 2014 LIFL, CEA LIST, and others. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin cedric.dumoulin@lifl.fr - Initial API and implementation + * Yann Tanguy yann.tanguy@cea.fr - Adapted from Class Diagram + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Adapted from composite structure diagram + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.profile; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.l10n.EditorMessages; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + +/** + * <pre> + * An editor to be used in multitabs editor. + * This editor extends the original UMLDiagramEditor generated by GMF. + * </pre> + */ +public class UmlProfileDiagramForMultiEditor extends UMLDiagramEditor { + + /** + * The location of diagram icon in the plug-in + */ + private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Profile.gif"; //$NON-NLS-1$ + + /** + * The EditingDomain ID for this diagram + */ + private static final String PROFIL_DIAGRAM_EDITING_DOMAIN_ID = "org.eclipse.papyrus.uml.diagram.profile.EditingDomain"; //$NON-NLS-1$ + + + + /** + * The image descriptor of the diagram icon + */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor. Context and required objects are retrieved from the ServiceRegistry. + * + * @throws BackboneException + * @throws ServiceException + * + */ + public UmlProfileDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + + } + + /** + * Returns an editing domain id used to retrive an editing domain from the editing domain + * registry. Clients should override this if they wish to use a shared editing domain for this + * editor. If null is returned then a new editing domain will be created per editor instance. + * + * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#getEditingDomainID() + * + */ + @Override + public String getEditingDomainID() { + return PROFIL_DIAGRAM_EDITING_DOMAIN_ID; + } + + /** + * {@inheritDoc} + */ + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + + + /** + * + * {@inheritDoc} + */ + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + // Set name after calling super.init() + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + + + /** + * + * {@inheritDoc} + */ + @Override + public void setInput(IEditorInput input) { + try { + // We are in a nested editor. + // Provide an URI with fragment in order to reuse the same Resource + // and to set the diagram to the fragment. + // First, compute the URI + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + //System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")"); //$NON-NLS-1$ + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = EditorMessages.Editor_error_setinput_title; + String msg = EditorMessages.Editor_error_setinput_message; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + + } + + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java index 6cb12cadcc9..250e8c4be6f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java @@ -1,88 +1,94 @@ -/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassPropertyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * The Class PropertyCommandForAssociation use to create a property into an association (ownedEnd)
- */
-public class PropertyCommandForAssociation extends ClassPropertyCreateCommand {
-
- /**
- * Instantiates a new property command for association.
- *
- * @param req
- * the req to launch the command
- */
- public PropertyCommandForAssociation(CreateElementRequest req, Diagram diagram) {
- super(req, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- protected EObject doDefaultElementCreation() {
- Property newElement = UMLFactory.eINSTANCE.createProperty();
-
- Association owner = (Association) getElementToEdit();
-
- Object type = getRequest().getParameter("type");
- if (type != null && type instanceof Type) {
- newElement.setType((Type) type);
- newElement.setName(((Type) type).getName());
- }
- owner.getOwnedEnds().add(newElement);
- ElementInitializers.getInstance().init_Property_ClassAttributeLabel(newElement);
- if (type != null && type instanceof Type) {
- newElement.setName(((Type) type).getName());
- }
- return newElement;
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Property newElement = (Property) doDefaultElementCreation();
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- protected EClass getEClassToEdit() {
- return UMLPackage.eINSTANCE.getAssociation();
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2008 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile.custom.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassPropertyCreateCommand; +import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * The Class PropertyCommandForAssociation use to create a property into an association (ownedEnd) + */ +public class PropertyCommandForAssociation extends ClassPropertyCreateCommand { + + /** + * Instantiates a new property command for association. + * + * @param req + * the req to launch the command + */ + public PropertyCommandForAssociation(CreateElementRequest req, Diagram diagram) { + super(req, diagram); + } + + /** + * {@inheritDoc} + */ + protected EObject doDefaultElementCreation() { + Property newElement = UMLFactory.eINSTANCE.createProperty(); + + Association owner = (Association) getElementToEdit(); + + Object type = getRequest().getParameter("type"); + if (type != null && type instanceof Type) { + newElement.setType((Type) type); + newElement.setName(((Type) type).getName()); + } + owner.getOwnedEnds().add(newElement); + ElementInitializers.getInstance().init_Property_ClassAttributeLabel(newElement); + if (type != null && type instanceof Type) { + newElement.setName(((Type) type).getName()); + if (InternationalizationPreferencesUtils.getInternationalizationPreference((Type) type) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((Type) type)) { + UMLLabelInternationalization.getInstance().setLabel((Type) type, UMLLabelInternationalization.getInstance().getLabelWithoutUML((Type) type), null); + } + } + return newElement; + } + + /** + * {@inheritedDoc} + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Property newElement = (Property) doDefaultElementCreation(); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * + * {@inheritDoc} + */ + @Override + protected EClass getEClassToEdit() { + return UMLPackage.eINSTANCE.getAssociation(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/policies/ExtensionCustomNameEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/policies/ExtensionCustomNameEditPolicy.java index f5d68cdef61..28e99be4964 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/policies/ExtensionCustomNameEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/policies/ExtensionCustomNameEditPolicy.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -29,6 +30,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener; import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart; import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.service.types.ui.util.ExtensionHelper; import org.eclipse.swt.widgets.Display; import org.eclipse.uml2.uml.Element; @@ -82,7 +84,7 @@ public class ExtensionCustomNameEditPolicy extends AbstractEditPolicy implements if (hostSemanticElement instanceof Extension) { Stereotype stereotype = ((Extension) hostSemanticElement).getStereotype(); getDiagramEventBroker().addNotificationListener(stereotype, this); - this.systemExtensionName = ((Extension) hostSemanticElement).getName(); + this.systemExtensionName = UMLLabelInternationalization.getInstance().getLabel(((Extension) hostSemanticElement)); } } @@ -143,12 +145,12 @@ public class ExtensionCustomNameEditPolicy extends AbstractEditPolicy implements CompositeCommand cc = new CompositeCommand("Change Extension Name"); //$NON-NLS-1$ Extension ext = ((Extension) hostSemanticElement); Stereotype ste = ((Extension) hostSemanticElement).getStereotype(); - String newExtEndName = ExtensionHelper.EXTENSION + ste.getName(); + String newExtEndName = ExtensionHelper.EXTENSION + UMLLabelInternationalization.getInstance().getLabel(ste); // Command to change the Extension's name // only if the user doesn't have modify its name String newExtensionName = ExtensionHelper.getExtensionName((Element) hostSemanticElement, ((Extension) hostSemanticElement).getStereotype(), ((Extension) hostSemanticElement).getMetaclass()); - if (systemExtensionName.equals(((Extension) hostSemanticElement).getName())) { + if (systemExtensionName.equals(UMLLabelInternationalization.getInstance().getLabel(((Extension) hostSemanticElement)))) { SetRequest setRequestExt = new SetRequest(domain, ext, UMLPackage.eINSTANCE.getNamedElement_Name(), newExtensionName); org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(ext); if (provider != null) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/parsers/MessageFormatParser.java index 0bc3cd67b32..2dd5292cdfb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/parsers/MessageFormatParser.java @@ -7,7 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.profile.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.profile.part.Messages; import org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -204,4 +212,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF index e888b2bf13c..6e201f40565 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF @@ -1,66 +1,68 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.sequence,
- org.eclipse.papyrus.uml.diagram.sequence.edit.parts,
- org.eclipse.papyrus.uml.diagram.sequence.edit.policies,
- org.eclipse.papyrus.uml.diagram.sequence.figures,
- org.eclipse.papyrus.uml.diagram.sequence.internal.constraints;x-internal:=true,
- org.eclipse.papyrus.uml.diagram.sequence.part,
- org.eclipse.papyrus.uml.diagram.sequence.providers,
- org.eclipse.papyrus.uml.diagram.sequence.util
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.infra.properties.ui;visibility:=reexport;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.uml.diagram.stereotype.edition;visibility:=reexport;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.uml.diagram.menu;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.expressions,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.infra.widgets,
- org.eclipse.papyrus.infra.ui,
- org.eclipse.papyrus.infra.core.sashwindows.di,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.papyrus.uml.diagram.common;visibility:=reexport,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
- org.eclipse.uml2.uml;visibility:=reexport,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.gmf.runtime.notation;visibility:=reexport,
- org.eclipse.gmf.tooling.runtime;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors,
- org.eclipse.papyrus.infra.services.edit
-Bundle-Vendor: %providerName
-Bundle-Version: 3.0.0.qualifier
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence; singleton:=true
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.sequence, + org.eclipse.papyrus.uml.diagram.sequence.edit.parts, + org.eclipse.papyrus.uml.diagram.sequence.edit.policies, + org.eclipse.papyrus.uml.diagram.sequence.figures, + org.eclipse.papyrus.uml.diagram.sequence.internal.constraints;x-internal:=true, + org.eclipse.papyrus.uml.diagram.sequence.part, + org.eclipse.papyrus.uml.diagram.sequence.providers, + org.eclipse.papyrus.uml.diagram.sequence.util +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)", + org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)", + org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)", + org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)", + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", + org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)", + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.properties.ui;visibility:=reexport;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.diagram.stereotype.edition;visibility:=reexport;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.diagram.menu;bundle-version="[2.0.0,3.0.0)", + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.core.expressions, + org.eclipse.jface, + org.eclipse.ui.ide, + org.eclipse.ui.views, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.emf.edit.ui, + org.eclipse.gmf.runtime.emf.core, + org.eclipse.gmf.runtime.emf.commands.core, + org.eclipse.gmf.runtime.emf.ui.properties, + org.eclipse.gmf.runtime.diagram.ui, + org.eclipse.papyrus.uml.diagram.common, + org.eclipse.papyrus.infra.gmfdiag.common, + org.eclipse.papyrus.infra.widgets, + org.eclipse.papyrus.infra.ui, + org.eclipse.papyrus.infra.core.sashwindows.di, + org.eclipse.gmf.runtime.diagram.ui.properties, + org.eclipse.gmf.runtime.diagram.ui.providers.ide, + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.draw2d;visibility:=reexport, + org.eclipse.papyrus.uml.diagram.common;visibility:=reexport, + org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport, + org.eclipse.uml2.uml;visibility:=reexport, + org.eclipse.uml2.uml.edit;visibility:=reexport, + org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.emf.ecore.edit;visibility:=reexport, + org.eclipse.emf.validation;visibility:=reexport, + org.eclipse.gmf.runtime.notation;visibility:=reexport, + org.eclipse.gmf.tooling.runtime;visibility:=reexport, + org.eclipse.gef, + org.eclipse.papyrus.extensionpoints.editors, + org.eclipse.papyrus.infra.services.edit, + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" +Bundle-Vendor: %providerName +Bundle-Version: 3.0.0.qualifier +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence; singleton:=true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/RestoreExecutionEndAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/RestoreExecutionEndAdvice.java index 679636cbc12..61f08324182 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/RestoreExecutionEndAdvice.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/RestoreExecutionEndAdvice.java @@ -1,235 +1,244 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationHelper;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.ExecutionSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Update execution ends after the connected message was removed.
- *
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=402975
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class RestoreExecutionEndAdvice extends AbstractEditHelperAdvice {
-
- /**
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected ICommand getAfterDestroyElementCommand(DestroyElementRequest request) {
- EObject elementToDestroy = request.getElementToDestroy();
- if (elementToDestroy instanceof Message) {
- final Message message = (Message) elementToDestroy;
- MessageEnd receiveEvent = message.getReceiveEvent();
- MessageEnd sendEvent = message.getSendEvent();
- CompositeCommand command = new CompositeCommand("Restore Execution End");
- if (receiveEvent instanceof MessageOccurrenceSpecification) {
- OccurrenceSpecification end = (OccurrenceSpecification) receiveEvent;
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true);
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false);
- }
- if (sendEvent instanceof MessageOccurrenceSpecification) {
- OccurrenceSpecification end = (OccurrenceSpecification) sendEvent;
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true);
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false);
- }
- if (command.canExecute()) {
- return command.reduce();
- }
- }
- // Try to restore the end of execution when the message end has been removed.
- else if (elementToDestroy instanceof MessageOccurrenceSpecification) {
- CompositeCommand command = new CompositeCommand("Restore Execution End");
- MessageOccurrenceSpecification end = (MessageOccurrenceSpecification) elementToDestroy;
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true);
- addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false);
- if (command.canExecute()) {
- return command.reduce();
- }
- }
- return super.getAfterDestroyElementCommand(request);
- }
-
- private void addRestoreExecutionEndCcommand(CompositeCommand command, TransactionalEditingDomain editingDomain, OccurrenceSpecification end, boolean isStart) {
- ExecutionSpecification execution = OccurrenceSpecificationHelper.findExecutionWith(end, isStart);
- if (execution == null) {
- return;
- }
- RestoreExecutionEndCommand cmd = new RestoreExecutionEndCommand(editingDomain, execution, isStart);
- cmd.setContainer((InteractionFragment) end.eContainer());
- cmd.setCovered(end.getCovered());
- // Add index support.
- int executionIndex = getIndex(execution);
- int index = getIndex(end);
- if (isStart && index > executionIndex) {
- index = executionIndex;
- } else if (!isStart && index <= executionIndex) {
- index = executionIndex + 1;
- }
- cmd.setIndex(index);
- command.add(cmd);
- }
-
- private int getIndex(InteractionFragment fragment) {
- if (fragment == null || fragment.eContainer() == null) {
- return -1;
- }
- EObject parent = fragment.eContainer();
- if (parent instanceof Interaction) {
- return ((Interaction) parent).getFragments().indexOf(fragment);
- } else if (parent instanceof InteractionOperand) {
- return ((InteractionOperand) parent).getFragments().indexOf(fragment);
- }
- return -1;
- }
-
- private class RestoreExecutionEndCommand extends AbstractTransactionalCommand {
-
- private ExecutionSpecification execution;
-
- private boolean isStart;
-
- private InteractionFragment container;
-
- private Lifeline covered;
-
- private int index;
-
- /**
- * Constructor.
- *
- * @param domain
- * @param isStart
- */
- public RestoreExecutionEndCommand(TransactionalEditingDomain domain, ExecutionSpecification execution, boolean isStart) {
- super(domain, "Restore Execution Ends when Message Destroied", null);
- this.execution = execution;
- this.isStart = isStart;
- }
-
- /**
- * @param index
- */
- public void setIndex(int index) {
- this.index = index;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- *
- * @param monitor
- * @param info
- * @return
- * @throws ExecutionException
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // Once the execution has been removed, ignore it.
- if (execution.eContainer() == null) {
- return CommandResult.newOKCommandResult();
- }
- ExecutionOccurrenceSpecification newEnd = null;
- InteractionFragment container = getContainer();
- EList<InteractionFragment> fragments = null;
- if (container instanceof Interaction) {
- newEnd = (ExecutionOccurrenceSpecification) ((Interaction) container).createFragment(null, UMLPackage.eINSTANCE.getExecutionOccurrenceSpecification());
- fragments = ((Interaction) container).getFragments();
- } else if (container instanceof InteractionOperand) {
- newEnd = (ExecutionOccurrenceSpecification) ((InteractionOperand) container).createFragment(null, UMLPackage.eINSTANCE.getExecutionOccurrenceSpecification());
- fragments = ((InteractionOperand) container).getFragments();
- }
- if (newEnd == null) {
- return CommandResult.newCancelledCommandResult();
- }
- newEnd.setExecution(execution);
- newEnd.setCovered(getCovered());
- if (isStart) {
- newEnd.setName(execution.getName() + "Start");
- execution.setStart(newEnd);
- } else {
- newEnd.setName(execution.getName() + "Finish");
- execution.setFinish(newEnd);
- }
- // Index support.
- if (index != -1 && fragments != null && index >= 0 && index < fragments.size() && fragments.indexOf(newEnd) != index) {
- fragments.move(index, newEnd);
- }
- return CommandResult.newOKCommandResult();
- }
-
- /**
- * @return the container
- */
- public InteractionFragment getContainer() {
- if (container == null && execution != null) {
- return (InteractionFragment) execution.eContainer();
- }
- return container;
- }
-
- /**
- * @param container
- * the container to set
- */
- public void setContainer(InteractionFragment container) {
- this.container = container;
- }
-
- /**
- * @return the covered
- */
- public Lifeline getCovered() {
- if (covered == null && execution != null) {
- EList<Lifeline> covereds = execution.getCovereds();
- return covereds.size() != 0 ? covereds.get(0) : null;
- }
- return covered;
- }
-
- /**
- * @param covered
- * the covered to set
- */
- public void setCovered(Lifeline covered) {
- this.covered = covered;
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA + * + * + * 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: + * Soyatec - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; +import org.eclipse.uml2.uml.ExecutionSpecification; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionFragment; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageEnd; +import org.eclipse.uml2.uml.MessageOccurrenceSpecification; +import org.eclipse.uml2.uml.OccurrenceSpecification; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Update execution ends after the connected message was removed. + * + * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=402975 + * + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class RestoreExecutionEndAdvice extends AbstractEditHelperAdvice { + + /** + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) + * + * @param request + * @return + */ + @Override + protected ICommand getAfterDestroyElementCommand(DestroyElementRequest request) { + EObject elementToDestroy = request.getElementToDestroy(); + if (elementToDestroy instanceof Message) { + final Message message = (Message) elementToDestroy; + MessageEnd receiveEvent = message.getReceiveEvent(); + MessageEnd sendEvent = message.getSendEvent(); + CompositeCommand command = new CompositeCommand("Restore Execution End"); + if (receiveEvent instanceof MessageOccurrenceSpecification) { + OccurrenceSpecification end = (OccurrenceSpecification) receiveEvent; + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true); + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false); + } + if (sendEvent instanceof MessageOccurrenceSpecification) { + OccurrenceSpecification end = (OccurrenceSpecification) sendEvent; + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true); + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false); + } + if (command.canExecute()) { + return command.reduce(); + } + } + // Try to restore the end of execution when the message end has been removed. + else if (elementToDestroy instanceof MessageOccurrenceSpecification) { + CompositeCommand command = new CompositeCommand("Restore Execution End"); + MessageOccurrenceSpecification end = (MessageOccurrenceSpecification) elementToDestroy; + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, true); + addRestoreExecutionEndCcommand(command, request.getEditingDomain(), end, false); + if (command.canExecute()) { + return command.reduce(); + } + } + return super.getAfterDestroyElementCommand(request); + } + + private void addRestoreExecutionEndCcommand(CompositeCommand command, TransactionalEditingDomain editingDomain, OccurrenceSpecification end, boolean isStart) { + ExecutionSpecification execution = OccurrenceSpecificationHelper.findExecutionWith(end, isStart); + if (execution == null) { + return; + } + RestoreExecutionEndCommand cmd = new RestoreExecutionEndCommand(editingDomain, execution, isStart); + cmd.setContainer((InteractionFragment) end.eContainer()); + cmd.setCovered(end.getCovered()); + // Add index support. + int executionIndex = getIndex(execution); + int index = getIndex(end); + if (isStart && index > executionIndex) { + index = executionIndex; + } else if (!isStart && index <= executionIndex) { + index = executionIndex + 1; + } + cmd.setIndex(index); + command.add(cmd); + } + + private int getIndex(InteractionFragment fragment) { + if (fragment == null || fragment.eContainer() == null) { + return -1; + } + EObject parent = fragment.eContainer(); + if (parent instanceof Interaction) { + return ((Interaction) parent).getFragments().indexOf(fragment); + } else if (parent instanceof InteractionOperand) { + return ((InteractionOperand) parent).getFragments().indexOf(fragment); + } + return -1; + } + + private class RestoreExecutionEndCommand extends AbstractTransactionalCommand { + + private ExecutionSpecification execution; + + private boolean isStart; + + private InteractionFragment container; + + private Lifeline covered; + + private int index; + + /** + * Constructor. + * + * @param domain + * @param isStart + */ + public RestoreExecutionEndCommand(TransactionalEditingDomain domain, ExecutionSpecification execution, boolean isStart) { + super(domain, "Restore Execution Ends when Message Destroied", null); + this.execution = execution; + this.isStart = isStart; + } + + /** + * @param index + */ + public void setIndex(int index) { + this.index = index; + } + + /** + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + * + * @param monitor + * @param info + * @return + * @throws ExecutionException + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + // Once the execution has been removed, ignore it. + if (execution.eContainer() == null) { + return CommandResult.newOKCommandResult(); + } + ExecutionOccurrenceSpecification newEnd = null; + InteractionFragment container = getContainer(); + EList<InteractionFragment> fragments = null; + if (container instanceof Interaction) { + newEnd = (ExecutionOccurrenceSpecification) ((Interaction) container).createFragment(null, UMLPackage.eINSTANCE.getExecutionOccurrenceSpecification()); + fragments = ((Interaction) container).getFragments(); + } else if (container instanceof InteractionOperand) { + newEnd = (ExecutionOccurrenceSpecification) ((InteractionOperand) container).createFragment(null, UMLPackage.eINSTANCE.getExecutionOccurrenceSpecification()); + fragments = ((InteractionOperand) container).getFragments(); + } + if (newEnd == null) { + return CommandResult.newCancelledCommandResult(); + } + newEnd.setExecution(execution); + newEnd.setCovered(getCovered()); + if (isStart) { + newEnd.setName(execution.getName() + "Start"); + execution.setStart(newEnd); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(execution) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution)) { + UMLLabelInternationalization.getInstance().setLabel(newEnd, UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution) + "Start", null); + } + } else { + newEnd.setName(execution.getName() + "Finish"); + execution.setFinish(newEnd); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(execution) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution)) { + UMLLabelInternationalization.getInstance().setLabel(newEnd, UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution) + "Finish", null); + } + } + // Index support. + if (index != -1 && fragments != null && index >= 0 && index < fragments.size() && fragments.indexOf(newEnd) != index) { + fragments.move(index, newEnd); + } + return CommandResult.newOKCommandResult(); + } + + /** + * @return the container + */ + public InteractionFragment getContainer() { + if (container == null && execution != null) { + return (InteractionFragment) execution.eContainer(); + } + return container; + } + + /** + * @param container + * the container to set + */ + public void setContainer(InteractionFragment container) { + this.container = container; + } + + /** + * @return the covered + */ + public Lifeline getCovered() { + if (covered == null && execution != null) { + EList<Lifeline> covereds = execution.getCovereds(); + return covereds.size() != 0 ? covereds.get(0) : null; + } + return covered; + } + + /** + * @param covered + * the covered to set + */ + public void setCovered(Lifeline covered) { + this.covered = covered; + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java index caa8c6c0731..0e52e96d0ed 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java @@ -1,177 +1,179 @@ -/*****************************************************************************
- * Copyright (c) 2009, 2014 Atos Origin, CEA, and others.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence;
-
-import java.text.Collator;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.util.FixGateViewOnOpening;
-import org.eclipse.papyrus.uml.diagram.sequence.util.FixInteractionOperandsOnOpening;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Editor used in multitabs editor.
- */
-public class UmlSequenceDiagramForMultiEditor extends UMLDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Sequence.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlSequenceDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- */
- public UmlSequenceDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- // Fix interaction operand bounds (see bug 400460)
- new FixInteractionOperandsOnOpening().fix(diagram);
- // Fix to add graphical view of gate. (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531)
- new FixGateViewOnOpening().fix(diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.sequence.EditingDomain";
- }
-
- @Override
- protected void applyCustomizationsToPalette(PaletteRoot paletteRoot) {
- super.applyCustomizationsToPalette(paletteRoot);
- // Sort Nodes of Palette
- List children = paletteRoot.getChildren();
- if (children.size() > 2) {
- Object nodes = children.get(1);
- if (nodes instanceof PaletteContainer) {
- doSort((PaletteContainer) nodes);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private void doSort(PaletteContainer nodes) {
- if (nodes == null) {
- return;
- }
- List children = nodes.getChildren();
- Collections.sort(children, new Comparator<PaletteEntry>() {
-
- @Override
- public int compare(PaletteEntry o1, PaletteEntry o2) {
- String l1 = o1.getLabel();
- String l2 = o2.getLabel();
- if (l1 != null && l2 != null) {
- return Collator.getInstance().compare(l1, l2);
- }
- return 0;
- }
- });
- }
-}
+/***************************************************************************** + * Copyright (c) 2009, 2014 Atos Origin, CEA, and others. + * + * + * 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: + * Atos Origin - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence; + +import java.text.Collator; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gef.palette.PaletteContainer; +import org.eclipse.gef.palette.PaletteEntry; +import org.eclipse.gef.palette.PaletteRoot; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.sequence.util.FixGateViewOnOpening; +import org.eclipse.papyrus.uml.diagram.sequence.util.FixInteractionOperandsOnOpening; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + +/** + * Editor used in multitabs editor. + */ +public class UmlSequenceDiagramForMultiEditor extends UMLDiagramEditor { + + /** + * The location of diagram icon in the plug-in + */ + private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Sequence.gif"; + + /** + * The image descriptor of the diagram icon + */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlSequenceDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the + * ServiceRegistry. + * + * @throws BackboneException + * @throws ServiceException + */ + public UmlSequenceDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + // Fix interaction operand bounds (see bug 400460) + new FixInteractionOperandsOnOpening().fix(diagram); + // Fix to add graphical view of gate. (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531) + new FixGateViewOnOpening().fix(diagram); + } + + /** + * {@inheritDoc} + */ + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setInput(IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; + String msg = "Cannot open input element:"; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + + /** + * {@inheritDoc} + */ + @Override + public String getEditingDomainID() { + return "org.eclipse.papyrus.uml.diagram.sequence.EditingDomain"; + } + + @Override + protected void applyCustomizationsToPalette(PaletteRoot paletteRoot) { + super.applyCustomizationsToPalette(paletteRoot); + // Sort Nodes of Palette + List children = paletteRoot.getChildren(); + if (children.size() > 2) { + Object nodes = children.get(1); + if (nodes instanceof PaletteContainer) { + doSort((PaletteContainer) nodes); + } + } + } + + @SuppressWarnings("unchecked") + private void doSort(PaletteContainer nodes) { + if (nodes == null) { + return; + } + List children = nodes.getChildren(); + Collections.sort(children, new Comparator<PaletteEntry>() { + + @Override + public int compare(PaletteEntry o1, PaletteEntry o2) { + String l1 = o1.getLabel(); + String l2 = o2.getLabel(); + if (l1 != null && l2 != null) { + return Collator.getInstance().compare(l1, l2); + } + return 0; + } + }); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageLabelHelper.java index 442ed70be38..252f9a25c84 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageLabelHelper.java @@ -1,153 +1,167 @@ -package org.eclipse.papyrus.uml.diagram.sequence.edit.helpers;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.tools.util.StringHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.OperationUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SignalUtil;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.TypedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-public class MessageLabelHelper extends StereotypedElementLabelHelper {
-
- public static final Collection<String> DEFAULT_LABEL_DISPLAY = Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE, ICustomAppearance.DISP_RT_TYPE);
-
- /**
- * singelton instance
- */
- private static MessageLabelHelper labelHelper;
-
- /** Map for masks */
- protected final Map<String, String> masks = new HashMap<String, String>();
-
- protected MessageLabelHelper() {
- // initialize the map
- masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility");
- masks.put(ICustomAppearance.DISP_NAME, "Name");
- masks.put(ICustomAppearance.DISP_PARAMETER_NAME, "Parameters Name");
- masks.put(ICustomAppearance.DISP_PARAMETER_DIRECTION, "Parameters Direction");
- masks.put(ICustomAppearance.DISP_PARAMETER_TYPE, "Parameters Type");
- masks.put(ICustomAppearance.DISP_RT_TYPE, "Return Type");
- masks.put(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity");
- masks.put(ICustomAppearance.DISP_PARAMETER_DEFAULT, "Parameters Default Value");
- masks.put(ICustomAppearance.DISP_DERIVE, "Parameters Value");
- masks.put(ICustomAppearance.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers");
- masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers");
- }
-
- /**
- * Returns the singleton instance of this class
- *
- * @return the singleton instance.
- */
- public static MessageLabelHelper getInstance() {
- if (labelHelper == null) {
- labelHelper = new MessageLabelHelper();
- }
- return labelHelper;
- }
-
- @Override
- public Message getUMLElement(GraphicalEditPart editPart) {
- EObject e = ((View) editPart.getModel()).getElement();
- if (e instanceof Message) {
- return ((Message) e);
- }
- return null;
- }
-
- @Override
- protected String elementLabel(GraphicalEditPart editPart) {
- if (editPart instanceof LabelEditPart) {
- editPart = (GraphicalEditPart) editPart.getParent();
- }
- Collection<String> displayValue = DEFAULT_LABEL_DISPLAY;
- IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (policy != null) {
- displayValue = policy.getCurrentDisplayValue();
- }
- Message e = getUMLElement(editPart);
- if (e == null) {
- return null;
- }
- NamedElement signature = e.getSignature();
- if (signature instanceof Operation) {
- return OperationUtil.getCustomLabel(e, (Operation) signature, displayValue);
- } else if (signature instanceof Signal) {
- return SignalUtil.getCustomLabel(e, (Signal) signature, displayValue);
- } else if (signature != null) {
- return signature.getName();
- }
- // signature is null
- return getMessageLabel(e, displayValue);
- }
-
- private String getMessageLabel(Message message, Collection<String> displayValue) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(message.getName());
- // parameters : '(' parameter-list ')'
- EList<ValueSpecification> arguments = message.getArguments();
- if (arguments.size() > 0 && (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME) || displayValue.contains(ICustomAppearance.DISP_DERIVE))) {
- buffer.append("(");
- for (int i = 0; i < arguments.size(); i++) {
- if (i > 0) {
- buffer.append(", ");
- }
- ValueSpecification arg = arguments.get(i);
- // type
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
- String type = TypedElementUtil.getTypeAsString(arg);
- if (type != null) {
- buffer.append(type);
- }
- }
- boolean showEqualMark = false;
- // name
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) {
- buffer.append(" ");
- String name = StringHelper.trimToEmpty(arg.getName());
- buffer.append(name);
- if (name.trim().length() > 0) {
- showEqualMark = true;
- }
- }
- // value
- if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) {
- String value = ValueSpecificationUtil.getSpecificationValue(arg);
- if (value != null) {
- if (showEqualMark) {
- buffer.append(" = ");
- }
- buffer.append(value);
- }
- }
- }
- buffer.append(")");
- }
- return buffer.toString();
- }
-
- public Map<String, String> getMasks() {
- return masks;
- }
-
- public Collection<String> getDefaultValue() {
- return DEFAULT_LABEL_DISPLAY;
- }
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + package org.eclipse.papyrus.uml.diagram.sequence.edit.helpers; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.tools.util.StringHelper; +import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.diagram.sequence.util.OperationUtil; +import org.eclipse.papyrus.uml.diagram.sequence.util.SignalUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.TypedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Signal; +import org.eclipse.uml2.uml.ValueSpecification; + +public class MessageLabelHelper extends StereotypedElementLabelHelper { + + public static final Collection<String> DEFAULT_LABEL_DISPLAY = Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE, ICustomAppearance.DISP_RT_TYPE); + + /** + * singelton instance + */ + private static MessageLabelHelper labelHelper; + + /** Map for masks */ + protected final Map<String, String> masks = new HashMap<String, String>(); + + protected MessageLabelHelper() { + // initialize the map + masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); + masks.put(ICustomAppearance.DISP_NAME, "Name"); + masks.put(ICustomAppearance.DISP_PARAMETER_NAME, "Parameters Name"); + masks.put(ICustomAppearance.DISP_PARAMETER_DIRECTION, "Parameters Direction"); + masks.put(ICustomAppearance.DISP_PARAMETER_TYPE, "Parameters Type"); + masks.put(ICustomAppearance.DISP_RT_TYPE, "Return Type"); + masks.put(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity"); + masks.put(ICustomAppearance.DISP_PARAMETER_DEFAULT, "Parameters Default Value"); + masks.put(ICustomAppearance.DISP_DERIVE, "Parameters Value"); + masks.put(ICustomAppearance.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers"); + masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); + } + + /** + * Returns the singleton instance of this class + * + * @return the singleton instance. + */ + public static MessageLabelHelper getInstance() { + if (labelHelper == null) { + labelHelper = new MessageLabelHelper(); + } + return labelHelper; + } + + @Override + public Message getUMLElement(GraphicalEditPart editPart) { + EObject e = ((View) editPart.getModel()).getElement(); + if (e instanceof Message) { + return ((Message) e); + } + return null; + } + + @Override + protected String elementLabel(GraphicalEditPart editPart) { + if (editPart instanceof LabelEditPart) { + editPart = (GraphicalEditPart) editPart.getParent(); + } + Collection<String> displayValue = DEFAULT_LABEL_DISPLAY; + IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (policy != null) { + displayValue = policy.getCurrentDisplayValue(); + } + Message e = getUMLElement(editPart); + if (e == null) { + return null; + } + NamedElement signature = e.getSignature(); + if (signature instanceof Operation) { + return OperationUtil.getCustomLabel(e, (Operation) signature, displayValue); + } else if (signature instanceof Signal) { + return SignalUtil.getCustomLabel(e, (Signal) signature, displayValue); + } else if (signature != null) { + return UMLLabelInternationalization.getInstance().getLabel(signature); + } + // signature is null + return getMessageLabel(e, displayValue); + } + + private String getMessageLabel(Message message, Collection<String> displayValue) { + StringBuffer buffer = new StringBuffer(); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(message)); + // parameters : '(' parameter-list ')' + EList<ValueSpecification> arguments = message.getArguments(); + if (arguments.size() > 0 && (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME) || displayValue.contains(ICustomAppearance.DISP_DERIVE))) { + buffer.append("("); + for (int i = 0; i < arguments.size(); i++) { + if (i > 0) { + buffer.append(", "); + } + ValueSpecification arg = arguments.get(i); + // type + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { + String type = TypedElementUtil.getTypeAsString(arg); + if (type != null) { + buffer.append(type); + } + } + boolean showEqualMark = false; + // name + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) { + buffer.append(" "); + String name = StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(arg)); + buffer.append(name); + if (name.trim().length() > 0) { + showEqualMark = true; + } + } + // value + if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) { + String value = ValueSpecificationUtil.getSpecificationValue(arg, true); + if (value != null) { + if (showEqualMark) { + buffer.append(" = "); + } + buffer.append(value); + } + } + } + buffer.append(")"); + } + return buffer.toString(); + } + + public Map<String, String> getMasks() { + return masks; + } + + public Collection<String> getDefaultValue() { + return DEFAULT_LABEL_DISPLAY; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentEditPart.java index fa21f31282d..3b5388001f5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentEditPart.java @@ -10,6 +10,7 @@ * Contributors: * Soyatec - Initial API and implementation * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440230 : Label Margin + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; @@ -81,13 +82,16 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.figure.IPapyrusWrappingLabel; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; import org.eclipse.papyrus.infra.gmfdiag.common.utils.FigureUtils; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure; @@ -105,6 +109,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper; import org.eclipse.papyrus.uml.diagram.sequence.util.ElementIconUtil; import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping; import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -116,6 +121,7 @@ import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.InteractionOperand; import org.eclipse.uml2.uml.InteractionOperatorKind; import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.UMLPackage; /** @@ -570,7 +576,7 @@ public class CustomCombinedFragmentEditPart extends CombinedFragmentEditPart imp Object element = resolveSemanticElement(); if (element instanceof CombinedFragment) { CombinedFragment combinedFragment = (CombinedFragment) element; - String name = combinedFragment.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(combinedFragment); int depth = AppearanceHelper.getQualifiedNameDepth(this.getNotationView()); if (depth == 0) { // full qualified name = combinedFragment.getQualifiedName(); @@ -767,7 +773,7 @@ public class CustomCombinedFragmentEditPart extends CombinedFragmentEditPart imp Object adapter = element.getAdapter(EObject.class); if (adapter instanceof CombinedFragment) { CombinedFragment cf = (CombinedFragment) adapter; - return cf.getName(); + return UMLLabelInternationalization.getInstance().getLabel(cf); } return ""; } @@ -784,8 +790,16 @@ public class CustomCombinedFragmentEditPart extends CombinedFragmentEditPart imp if (editingDomain == null || !(element instanceof CombinedFragment)) { return UnexecutableCommand.INSTANCE; } - SetRequest request = new SetRequest(element, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); - return new SetValueCommand(request); + + ICommand command = null; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, newString, null)); + } else { + SetRequest request = new SetRequest(element, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); + command = new SetValueCommand(request); + } + return command; } @Override @@ -793,7 +807,7 @@ public class CustomCombinedFragmentEditPart extends CombinedFragmentEditPart imp Object adapter = element.getAdapter(EObject.class); if (adapter instanceof CombinedFragment) { CombinedFragment cf = (CombinedFragment) adapter; - return cf.getName(); + return UMLLabelInternationalization.getInstance().getLabel(cf); } return ""; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java index f81964bf6b6..abeba2b82d7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java @@ -1,203 +1,205 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomConsiderIgnoreFragmentItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
-import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
-import org.eclipse.uml2.uml.InteractionOperatorKind;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Reception;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomConsiderIgnoreFragmentEditPart extends CustomCombinedFragmentEditPart {
-
- /**
- * Notfier for listen and unlistend model element.
- */
- private NotificationHelper notifier = null;
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomConsiderIgnoreFragmentEditPart(View view) {
- super(view);
- }
-
- /**
- * Try to use the notifier from super class, if not exist, create new one.
- */
- protected NotificationHelper getNotifier() {
- if (notifier == null) {
- try {
- Field f = ConsiderIgnoreFragmentEditPart.class.getDeclaredField("notifier");
- f.setAccessible(true);
- notifier = (NotificationHelper) f.get(this);
- } catch (Exception e) {
- notifier = new NotificationHelper(new UIAdapterImpl() {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- handleNotificationEvent(msg);
- }
- });
- }
- }
- return notifier;
- }
-
- @Override
- protected NodeFigure createNodePlate() {
- String prefElementId = "ConsiderIgnoreFragment";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT);
- DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
- return result;
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomConsiderIgnoreFragmentItemSemanticEditPolicy());
- }
-
- /**
- * Handle for message
- */
- @Override
- protected void handleNotificationEvent(Notification notification) {
- final NotificationHelper notifier = getNotifier();
- Object feature = notification.getFeature();
- if (UMLPackage.eINSTANCE.getConsiderIgnoreFragment_Message().equals(feature)) {
- // Handle message creation
- Object newValue = notification.getNewValue();
- // TODO Filter NamedElements type for message on higher level
- if (newValue == null || newValue instanceof Operation || newValue instanceof Reception || newValue instanceof Signal) {
- updateHeaderLabel();
- notifier.unlistenObject((Notifier) notification.getOldValue());
- notifier.listenObject((Notifier) notification.getNewValue());
- } else {
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- considerIgnoreFragment.getMessages().remove(newValue);
- }
- } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature)) {
- // Handle message modification
- updateHeaderLabel();
- }
- super.handleNotificationEvent(notification);
- }
-
- /**
- * Update operator kind
- */
- @Override
- protected void updateHeaderLabel() {
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- StringBuilder operatorKind = new StringBuilder();
- operatorKind.append(considerIgnoreFragment.getInteractionOperator().getName());
- EList<NamedElement> messages = considerIgnoreFragment.getMessages();
- if (messages != null && messages.size() > 0) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < messages.size(); i++) {
- String name = messages.get(i).getName();
- if (name != null) {
- sb.append(name).append(",");
- }
- }
- if (sb.length() > 0) {
- operatorKind.append(" {").append(sb.deleteCharAt(sb.length() - 1).toString()).append("}");
- }
- }
- getPrimaryShape().getHeaderLabel().setText(operatorKind.toString());
- }
-
- /**
- * Return true if the InteractionOperatorKind is allowed
- *
- * @param interactionOperatorLiteral
- * The InteractionOperator to test
- * @return true if allowed
- */
- @Override
- protected boolean isAllowedInteractionOperator(String interactionOperatorLiteral) {
- return InteractionOperatorKind.CONSIDER_LITERAL.getLiteral().equals(interactionOperatorLiteral) || InteractionOperatorKind.IGNORE_LITERAL.getLiteral().equals(interactionOperatorLiteral);
- }
-
- /**
- * Activate a listener for the interactionUse to Handle notification in the refered Interaction
- */
- @Override
- public void activate() {
- super.activate();
- final NotificationHelper notifier = getNotifier();
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- for (NamedElement message : considerIgnoreFragment.getMessages()) {
- notifier.listenObject(message);
- }
- }
-
- /**
- * Deactivate a listener for the interactionUse to Handle notification in the refered
- * Interaction
- */
- @Override
- public void deactivate() {
- super.deactivate();
- if (notifier != null) {
- notifier.unlistenAll();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeNotify() {
- if (notifier != null) {
- notifier.unlistenAll();
- }
- super.removeNotify();
- }
-
- @Override
- public String getTitlePreferenceKey() {
- return "ELEMENT_PapyrusUMLSequenceDiagram_ConsiderIgnoreFragment_CombinedFragmentCompartment.compartment_name.visibility";
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Soyatec - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; + +import java.lang.reflect.Field; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; +import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; +import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomConsiderIgnoreFragmentItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.ConsiderIgnoreFragment; +import org.eclipse.uml2.uml.InteractionOperatorKind; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Reception; +import org.eclipse.uml2.uml.Signal; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class CustomConsiderIgnoreFragmentEditPart extends CustomCombinedFragmentEditPart { + + /** + * Notfier for listen and unlistend model element. + */ + private NotificationHelper notifier = null; + + /** + * Constructor. + * + * @param view + */ + public CustomConsiderIgnoreFragmentEditPart(View view) { + super(view); + } + + /** + * Try to use the notifier from super class, if not exist, create new one. + */ + protected NotificationHelper getNotifier() { + if (notifier == null) { + try { + Field f = ConsiderIgnoreFragmentEditPart.class.getDeclaredField("notifier"); + f.setAccessible(true); + notifier = (NotificationHelper) f.get(this); + } catch (Exception e) { + notifier = new NotificationHelper(new UIAdapterImpl() { + + @Override + protected void safeNotifyChanged(Notification msg) { + handleNotificationEvent(msg); + } + }); + } + } + return notifier; + } + + @Override + protected NodeFigure createNodePlate() { + String prefElementId = "ConsiderIgnoreFragment"; + IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); + String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH); + String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT); + DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); + return result; + } + + /** + * @Override + */ + @Override + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomConsiderIgnoreFragmentItemSemanticEditPolicy()); + } + + /** + * Handle for message + */ + @Override + protected void handleNotificationEvent(Notification notification) { + final NotificationHelper notifier = getNotifier(); + Object feature = notification.getFeature(); + if (UMLPackage.eINSTANCE.getConsiderIgnoreFragment_Message().equals(feature)) { + // Handle message creation + Object newValue = notification.getNewValue(); + // TODO Filter NamedElements type for message on higher level + if (newValue == null || newValue instanceof Operation || newValue instanceof Reception || newValue instanceof Signal) { + updateHeaderLabel(); + notifier.unlistenObject((Notifier) notification.getOldValue()); + notifier.listenObject((Notifier) notification.getNewValue()); + } else { + ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement(); + considerIgnoreFragment.getMessages().remove(newValue); + } + } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature)) { + // Handle message modification + updateHeaderLabel(); + } + super.handleNotificationEvent(notification); + } + + /** + * Update operator kind + */ + @Override + protected void updateHeaderLabel() { + ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement(); + StringBuilder operatorKind = new StringBuilder(); + operatorKind.append(considerIgnoreFragment.getInteractionOperator().getName()); + EList<NamedElement> messages = considerIgnoreFragment.getMessages(); + if (messages != null && messages.size() > 0) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < messages.size(); i++) { + String name = UMLLabelInternationalization.getInstance().getLabel(messages.get(i)); + if (name != null) { + sb.append(name).append(","); + } + } + if (sb.length() > 0) { + operatorKind.append(" {").append(sb.deleteCharAt(sb.length() - 1).toString()).append("}"); + } + } + getPrimaryShape().getHeaderLabel().setText(operatorKind.toString()); + } + + /** + * Return true if the InteractionOperatorKind is allowed + * + * @param interactionOperatorLiteral + * The InteractionOperator to test + * @return true if allowed + */ + @Override + protected boolean isAllowedInteractionOperator(String interactionOperatorLiteral) { + return InteractionOperatorKind.CONSIDER_LITERAL.getLiteral().equals(interactionOperatorLiteral) || InteractionOperatorKind.IGNORE_LITERAL.getLiteral().equals(interactionOperatorLiteral); + } + + /** + * Activate a listener for the interactionUse to Handle notification in the refered Interaction + */ + @Override + public void activate() { + super.activate(); + final NotificationHelper notifier = getNotifier(); + ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement(); + for (NamedElement message : considerIgnoreFragment.getMessages()) { + notifier.listenObject(message); + } + } + + /** + * Deactivate a listener for the interactionUse to Handle notification in the refered + * Interaction + */ + @Override + public void deactivate() { + super.deactivate(); + if (notifier != null) { + notifier.unlistenAll(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void removeNotify() { + if (notifier != null) { + notifier.unlistenAll(); + } + super.removeNotify(); + } + + @Override + public String getTitlePreferenceKey() { + return "ELEMENT_PapyrusUMLSequenceDiagram_ConsiderIgnoreFragment_CombinedFragmentCompartment.compartment_name.visibility"; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionUseEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionUseEditPart.java index fca37586aa2..b8673848d99 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionUseEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionUseEditPart.java @@ -1,420 +1,426 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.lang.reflect.Field;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.GateCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.GatesHolderGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomInteractionUseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.InteractionUseRectangleFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionUseUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater;
-import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Add implementing IPapyrusEditPart to displaying Stereotypes.
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomInteractionUseEditPart extends InteractionUseEditPart {
-
- /**
- * Notfier for listen and unlistend model element.
- */
- private NotificationHelper notifier = null;
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomInteractionUseEditPart(View view) {
- super(view);
- }
-
- /**
- * Try to use the notifier from super class, if not exist, create new one.
- */
- protected NotificationHelper getNotifier() {
- if (notifier == null) {
- try {
- Field f = InteractionUseEditPart.class.getDeclaredField("notifier");
- f.setAccessible(true);
- notifier = (NotificationHelper) f.get(this);
- } catch (Exception e) {
- notifier = new NotificationHelper(new UIAdapterImpl() {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- handleNotificationEvent(msg);
- }
- });
- }
- }
- return notifier;
- }
-
- @Override
- protected void setLineWidth(int width) {
- if (primaryShape instanceof Shape) {
- ((Shape) primaryShape).setLineWidth(width);
- }
- super.setLineWidth(width);
- }
-
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new InteractionUseRectangleFigure();
- getPrimaryShape().setShadow(false);
- return primaryShape;
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomInteractionUseItemSemanticEditPolicy());
- // installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new SequenceGraphicalNodeEditPolicy());
- // Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new GatesHolderGraphicalNodeEditPolicy());
- installEditPolicy("Gate Creation Edit Policy", new GateCreationEditPolicy());
- // install a editpolicy to display stereotypes
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- }
-
- /**
- * Create a BorderedNodeFigure for holding Gates.
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new BorderedNodeFigure(super.createNodeFigure());
- }
-
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- @Override
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof GateEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((GateEditPart) childEditPart).getFigure());
- return true;
- }
- return super.removeFixedChild(childEditPart);
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart#addFixedChild(org.eclipse.gef.EditPart)
- *
- * @param childEditPart
- * @return
- */
- @Override
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof GateEditPart) {
- getBorderedFigure().getBorderItemContainer().add(((GateEditPart) childEditPart).getFigure(), new GateLocator((GateEditPart) childEditPart, getFigure()));
- return true;
- }
- return super.addFixedChild(childEditPart);
- }
-
- /**
- * Override to set the transparency to the correct figure
- */
- @Override
- protected void setTransparency(int transp) {
- getPrimaryShape().setTransparency(transp);
- }
-
- /**
- * sets the back ground color of this edit part
- *
- * @param color
- * the new value of the back ground color
- */
- @Override
- protected void setBackgroundColor(Color color) {
- getPrimaryShape().setBackgroundColor(color);
- getPrimaryShape().setIsUsingGradient(false);
- getPrimaryShape().setGradientData(-1, -1, 0);
- }
-
- /**
- * Override to set the gradient data to the correct figure
- */
- @Override
- protected void setGradient(GradientData gradient) {
- IPapyrusNodeFigure fig = getPrimaryShape();
- FillStyle style = (FillStyle) getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE);
- if (gradient != null) {
- fig.setIsUsingGradient(true);
- ;
- fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle());
- } else {
- fig.setIsUsingGradient(false);
- }
- }
-
- @Override
- public boolean supportsGradient() {
- return true;
- }
-
- /**
- * Handle for gates operator and covered lifelines
- */
- @Override
- protected void handleNotificationEvent(Notification notification) {
- final NotificationHelper notifier = getNotifier();
- Object feature = notification.getFeature();
- if (UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature)) {
- if (notification.getOldValue() instanceof Interaction) {
- notifier.unlistenAll();
- // notifier.unlistenObject((Interaction) notification.getOldValue());
- }
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), interactionUse.getActualGates()), true);
- if (notification.getNewValue() instanceof Interaction) {
- Interaction interaction = (Interaction) notification.getNewValue();
- notifier.listenObject(interaction);
- interactionUse.getActualGates();
- List<Gate> formalGates = interaction.getFormalGates();
- for (Gate formalGate : formalGates) {
- Gate newActualGate = (Gate) EcoreUtil.create(UMLPackage.Literals.GATE);
- newActualGate.setName(formalGate.getName());
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true);
- notifier.listenObject(formalGate);
- notifier.listenObject(newActualGate);
- }
- }
- } else if (UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature)) {
- activate();
- resizeInteractionFragmentFigure();
- } else if (UMLPackage.eINSTANCE.getInteraction_FormalGate().equals(feature)) {
- // Handle formal gate
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Object oldValue = notification.getOldValue();
- if (oldValue instanceof Gate) {
- notifier.unlistenObject((Gate) oldValue);
- List<Gate> actualGates = interactionUse.getActualGates();
- for (int i = actualGates.size() - 1; i >= 0; i--) {
- Gate element = actualGates.get(i);
- if (((Gate) oldValue).getName().equals(element.getName())) {
- notifier.unlistenObject(element);
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), element), true);
- }
- }
- }
- Object newValue = notification.getNewValue();
- if (newValue instanceof Gate) {
- Gate actualGate = interactionUse.createActualGate(((Gate) newValue).getName());
- notifier.listenObject((Gate) newValue);
- notifier.listenObject(actualGate);
- }
- } else if (UMLPackage.eINSTANCE.getInteractionUse_ActualGate().equals(feature)) {
- if (notification.getEventType() == Notification.ADD) {
- // Block manual creation of actual gate
- // if(notification.getNewValue() instanceof Gate) {
- // Gate newActualGate = (Gate)notification.getNewValue();
- // if(!checkActualGateExistence(newActualGate)) {
- // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_CREATION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_CREATION_DLG_MSG);
- // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true);
- // }
- // }
- } else if (notification.getEventType() == Notification.REMOVE) {
- // Block manual deletion of actual gate
- // if(notification.getOldValue() instanceof Gate) {
- // Gate oldActualGate = (Gate)notification.getOldValue();
- // //There are some issues in redo progress, check if there is other one with same time firstly.
- // InteractionUse interactionUse = (InteractionUse)notification.getNotifier();
- // Gate otherOne = interactionUse.getActualGate(oldActualGate.getName());
- // if(otherOne == null && checkActualGateExistence(oldActualGate)) {
- // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_DELETION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_DELETION_DLG_MSG);
- // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), oldActualGate), true);
- // }
- // }
- }
- } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) && notification.getNotifier() instanceof Gate) {
- Gate gate = (Gate) notification.getNotifier();
- if (gate.eContainer() instanceof Interaction) {
- // Handle modification of formal gate's name
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- List<Gate> actualGates = interactionUse.getActualGates();
- String oldValue = notification.getOldStringValue();
- String newValue = notification.getNewStringValue();
- for (Gate actualGate : actualGates) {
- if (oldValue == null && actualGate.getName() == null || oldValue != null && oldValue.equals(actualGate.getName())) {
- notifier.unlistenObject(actualGate); // Delete listener on gate
- actualGate.setName(newValue);
- notifier.listenObject(actualGate); // Add listener on gate
- }
- }
- } else if (gate.eContainer() instanceof InteractionUse) {
- // Block modification of actual gate's name
- notifier.unlistenObject(gate); // Delete listener on gate
- gate.setName(notification.getOldStringValue());
- notifier.listenObject(gate); // Add listener on gate
- }
- }
- if ((getModel() != null) && (getModel() == notification.getNotifier())) {
- if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
- refreshLineWidth();
- }
- }
- if (notification.getNotifier() instanceof Bounds) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater();
- updater.update(CustomInteractionUseEditPart.this);
- }
- });
- }
- refreshShadow();
- super.handleNotificationEvent(notification);
- }
-
- /**
- * Check if actual gate is attached to a formal gate
- *
- * @return true if there is a formal gate corresponding to the actual gate
- */
- private boolean checkActualGateExistence(Gate actualGate) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- // Find if the corresponding formal gate exists
- for (Gate formalGate : interaction.getFormalGates()) {
- if (formalGate.getName().equals(actualGate.getName())) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Activate a listener for the interactionUse to Handle notification in the refered Interaction
- */
- @Override
- public void activate() {
- super.activate();
- final NotificationHelper notifier = getNotifier();
- if (resolveSemanticElement() instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- // activate the listener on the referred interaction
- notifier.listenObject(interaction);
- for (Gate formalGate : interaction.getFormalGates()) {
- notifier.listenObject(formalGate);
- }
- }
- for (Gate actualGate : interactionUse.getActualGates()) {
- notifier.listenObject(actualGate);
- }
- }
- }
-
- /**
- * Deactivate a listener for the interactionUse to handle notification in the refered
- * Interaction
- */
- @Override
- public void deactivate() {
- super.deactivate();
- if (notifier != null) {
- notifier.unlistenAll();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeNotify() {
- if (notifier != null) {
- notifier.unlistenAll();
- }
- super.removeNotify();
- }
-
- @Override
- public void performRequest(Request request) {
- if (request.getType().equals(REQ_OPEN)) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction == null) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "There is no referenced interaction!");
- return;
- }
- Diagram diagram = InteractionUseUtil.findDiagram(getNotationView(), interaction);
- if (diagram == null) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "Cannot find diagram of the referenced interaction!");
- } else {
- InteractionUseUtil.openDiagram(diagram);
- }
- return;
- }
- super.performRequest(request);
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshTransparency();
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Soyatec - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; + +import java.lang.reflect.Field; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Shape; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.FillStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.gmf.runtime.notation.datatype.GradientData; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.GateCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.GatesHolderGraphicalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomInteractionUseItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.figures.InteractionUseRectangleFigure; +import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator; +import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper; +import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionUseUtil; +import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater; +import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Gate; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionUse; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Add implementing IPapyrusEditPart to displaying Stereotypes. + * + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class CustomInteractionUseEditPart extends InteractionUseEditPart { + + /** + * Notfier for listen and unlistend model element. + */ + private NotificationHelper notifier = null; + + /** + * Constructor. + * + * @param view + */ + public CustomInteractionUseEditPart(View view) { + super(view); + } + + /** + * Try to use the notifier from super class, if not exist, create new one. + */ + protected NotificationHelper getNotifier() { + if (notifier == null) { + try { + Field f = InteractionUseEditPart.class.getDeclaredField("notifier"); + f.setAccessible(true); + notifier = (NotificationHelper) f.get(this); + } catch (Exception e) { + notifier = new NotificationHelper(new UIAdapterImpl() { + + @Override + protected void safeNotifyChanged(Notification msg) { + handleNotificationEvent(msg); + } + }); + } + } + return notifier; + } + + @Override + protected void setLineWidth(int width) { + if (primaryShape instanceof Shape) { + ((Shape) primaryShape).setLineWidth(width); + } + super.setLineWidth(width); + } + + @Override + protected IFigure createNodeShape() { + primaryShape = new InteractionUseRectangleFigure(); + getPrimaryShape().setShadow(false); + return primaryShape; + } + + /** + * @Override + */ + @Override + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomInteractionUseItemSemanticEditPolicy()); + // installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new SequenceGraphicalNodeEditPolicy()); + // Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531 + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new GatesHolderGraphicalNodeEditPolicy()); + installEditPolicy("Gate Creation Edit Policy", new GateCreationEditPolicy()); + // install a editpolicy to display stereotypes + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + } + + /** + * Create a BorderedNodeFigure for holding Gates. + */ + @Override + protected NodeFigure createNodeFigure() { + return new BorderedNodeFigure(super.createNodeFigure()); + } + + @Override + protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof IBorderItemEditPart) { + return getBorderedFigure().getBorderItemContainer(); + } + return getContentPane(); + } + + @Override + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof GateEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((GateEditPart) childEditPart).getFigure()); + return true; + } + return super.removeFixedChild(childEditPart); + } + + /** + * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart#addFixedChild(org.eclipse.gef.EditPart) + * + * @param childEditPart + * @return + */ + @Override + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof GateEditPart) { + getBorderedFigure().getBorderItemContainer().add(((GateEditPart) childEditPart).getFigure(), new GateLocator((GateEditPart) childEditPart, getFigure())); + return true; + } + return super.addFixedChild(childEditPart); + } + + /** + * Override to set the transparency to the correct figure + */ + @Override + protected void setTransparency(int transp) { + getPrimaryShape().setTransparency(transp); + } + + /** + * sets the back ground color of this edit part + * + * @param color + * the new value of the back ground color + */ + @Override + protected void setBackgroundColor(Color color) { + getPrimaryShape().setBackgroundColor(color); + getPrimaryShape().setIsUsingGradient(false); + getPrimaryShape().setGradientData(-1, -1, 0); + } + + /** + * Override to set the gradient data to the correct figure + */ + @Override + protected void setGradient(GradientData gradient) { + IPapyrusNodeFigure fig = getPrimaryShape(); + FillStyle style = (FillStyle) getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE); + if (gradient != null) { + fig.setIsUsingGradient(true); + ; + fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle()); + } else { + fig.setIsUsingGradient(false); + } + } + + @Override + public boolean supportsGradient() { + return true; + } + + /** + * Handle for gates operator and covered lifelines + */ + @Override + protected void handleNotificationEvent(Notification notification) { + final NotificationHelper notifier = getNotifier(); + Object feature = notification.getFeature(); + if (UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature)) { + if (notification.getOldValue() instanceof Interaction) { + notifier.unlistenAll(); + // notifier.unlistenObject((Interaction) notification.getOldValue()); + } + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), interactionUse.getActualGates()), true); + if (notification.getNewValue() instanceof Interaction) { + Interaction interaction = (Interaction) notification.getNewValue(); + notifier.listenObject(interaction); + interactionUse.getActualGates(); + List<Gate> formalGates = interaction.getFormalGates(); + for (Gate formalGate : formalGates) { + Gate newActualGate = (Gate) EcoreUtil.create(UMLPackage.Literals.GATE); + newActualGate.setName(formalGate.getName()); + CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(formalGate) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(formalGate)) { + UMLLabelInternationalization.getInstance().setLabel(newActualGate, UMLLabelInternationalization.getInstance().getLabelWithoutUML(formalGate), null); + } + notifier.listenObject(formalGate); + notifier.listenObject(newActualGate); + } + } + } else if (UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature)) { + activate(); + resizeInteractionFragmentFigure(); + } else if (UMLPackage.eINSTANCE.getInteraction_FormalGate().equals(feature)) { + // Handle formal gate + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + Object oldValue = notification.getOldValue(); + if (oldValue instanceof Gate) { + notifier.unlistenObject((Gate) oldValue); + List<Gate> actualGates = interactionUse.getActualGates(); + for (int i = actualGates.size() - 1; i >= 0; i--) { + Gate element = actualGates.get(i); + if (((Gate) oldValue).getName().equals(element.getName())) { + notifier.unlistenObject(element); + CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), element), true); + } + } + } + Object newValue = notification.getNewValue(); + if (newValue instanceof Gate) { + Gate actualGate = interactionUse.createActualGate(((Gate) newValue).getName()); + notifier.listenObject((Gate) newValue); + notifier.listenObject(actualGate); + } + } else if (UMLPackage.eINSTANCE.getInteractionUse_ActualGate().equals(feature)) { + if (notification.getEventType() == Notification.ADD) { + // Block manual creation of actual gate + // if(notification.getNewValue() instanceof Gate) { + // Gate newActualGate = (Gate)notification.getNewValue(); + // if(!checkActualGateExistence(newActualGate)) { + // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_CREATION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_CREATION_DLG_MSG); + // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true); + // } + // } + } else if (notification.getEventType() == Notification.REMOVE) { + // Block manual deletion of actual gate + // if(notification.getOldValue() instanceof Gate) { + // Gate oldActualGate = (Gate)notification.getOldValue(); + // //There are some issues in redo progress, check if there is other one with same time firstly. + // InteractionUse interactionUse = (InteractionUse)notification.getNotifier(); + // Gate otherOne = interactionUse.getActualGate(oldActualGate.getName()); + // if(otherOne == null && checkActualGateExistence(oldActualGate)) { + // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_DELETION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_DELETION_DLG_MSG); + // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), oldActualGate), true); + // } + // } + } + } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) && notification.getNotifier() instanceof Gate) { + Gate gate = (Gate) notification.getNotifier(); + if (gate.eContainer() instanceof Interaction) { + // Handle modification of formal gate's name + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + List<Gate> actualGates = interactionUse.getActualGates(); + String oldValue = notification.getOldStringValue(); + String newValue = notification.getNewStringValue(); + for (Gate actualGate : actualGates) { + if (oldValue == null && actualGate.getName() == null || oldValue != null && oldValue.equals(actualGate.getName())) { + notifier.unlistenObject(actualGate); // Delete listener on gate + actualGate.setName(newValue); + notifier.listenObject(actualGate); // Add listener on gate + } + } + } else if (gate.eContainer() instanceof InteractionUse) { + // Block modification of actual gate's name + notifier.unlistenObject(gate); // Delete listener on gate + gate.setName(notification.getOldStringValue()); + notifier.listenObject(gate); // Add listener on gate + } + } + if ((getModel() != null) && (getModel() == notification.getNotifier())) { + if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) { + refreshLineWidth(); + } + } + if (notification.getNotifier() instanceof Bounds) { + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater(); + updater.update(CustomInteractionUseEditPart.this); + } + }); + } + refreshShadow(); + super.handleNotificationEvent(notification); + } + + /** + * Check if actual gate is attached to a formal gate + * + * @return true if there is a formal gate corresponding to the actual gate + */ + private boolean checkActualGateExistence(Gate actualGate) { + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + Interaction interaction = interactionUse.getRefersTo(); + if (interaction != null) { + // Find if the corresponding formal gate exists + for (Gate formalGate : interaction.getFormalGates()) { + if (formalGate.getName().equals(actualGate.getName())) { + return true; + } + } + } + return false; + } + + /** + * Activate a listener for the interactionUse to Handle notification in the refered Interaction + */ + @Override + public void activate() { + super.activate(); + final NotificationHelper notifier = getNotifier(); + if (resolveSemanticElement() instanceof InteractionUse) { + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + Interaction interaction = interactionUse.getRefersTo(); + if (interaction != null) { + // activate the listener on the referred interaction + notifier.listenObject(interaction); + for (Gate formalGate : interaction.getFormalGates()) { + notifier.listenObject(formalGate); + } + } + for (Gate actualGate : interactionUse.getActualGates()) { + notifier.listenObject(actualGate); + } + } + } + + /** + * Deactivate a listener for the interactionUse to handle notification in the refered + * Interaction + */ + @Override + public void deactivate() { + super.deactivate(); + if (notifier != null) { + notifier.unlistenAll(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void removeNotify() { + if (notifier != null) { + notifier.unlistenAll(); + } + super.removeNotify(); + } + + @Override + public void performRequest(Request request) { + if (request.getType().equals(REQ_OPEN)) { + InteractionUse interactionUse = (InteractionUse) resolveSemanticElement(); + Interaction interaction = interactionUse.getRefersTo(); + if (interaction == null) { + MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "There is no referenced interaction!"); + return; + } + Diagram diagram = InteractionUseUtil.findDiagram(getNotationView(), interaction); + if (diagram == null) { + MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "Cannot find diagram of the referenced interaction!"); + } else { + InteractionUseUtil.openDiagram(diagram); + } + return; + } + super.performRequest(request); + } + + @Override + protected void refreshVisuals() { + super.refreshVisuals(); + refreshTransparency(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java index 47670cb5104..59f92d81a82 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java @@ -1,373 +1,387 @@ -package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeExternalNodeLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * 1. Refactoring with a BorderItemLabelEditPart.
- * 2. Add displaying stereotypes.
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyrusEditPart {
-
- public static final String GATE_NAME_TYPE = "Gate_Name";
-
- static {
- registerSnapBackPosition(GATE_NAME_TYPE, new Point(-32, 0));
- }
-
- /**
- * Constructor.
- *
- * @param view
- */
- public GateNameEditPart(View view) {
- super(view);
- }
-
- @Override
- public int getDirectEditionType() {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- // Display stereotype on name figure.
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeLabelEditPolicy());
- }
-
- @Override
- public IFigure getPrimaryShape() {
- return getFigure();
- }
-
- @Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- @Override
- protected Point getLocation() {
- Point location = super.getLocation();
- if (location.x == 0 && location.y == 0) {
- Dimension size = getSize();
- EditPart parent = getParent();
- if (parent instanceof GateEditPart) {
- GateEditPart gateEditPart = ((GateEditPart) parent);
- EObject elt = gateEditPart.resolveSemanticElement();
- Dimension preferredSize = getFigure().getPreferredSize(size.width, size.height);
- IBorderItemLocator locator = gateEditPart.getBorderItemLocator();
- if (locator instanceof GateLocator) {
- int alignment = ((GateLocator) locator).getAlignment(((GateLocator) locator).getConstraint());
- if (PositionConstants.LEFT == alignment) {
- if (gateEditPart.getTargetConnections().isEmpty()) {
- location.x = -preferredSize.width - 1;
- } else {
- location.x = GateEditPart.DEFAULT_SIZE.width + 1;
- }
- if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) {
- location.y = GateEditPart.DEFAULT_SIZE.height - 2;// move fown
- } else {
- location.y = -GateEditPart.DEFAULT_SIZE.height + 2;// move up
- }
- } else if (PositionConstants.RIGHT == alignment) {
- if (gateEditPart.getSourceConnections().isEmpty()) {
- location.x = GateEditPart.DEFAULT_SIZE.width + 1;
- } else {
- location.x = -preferredSize.width - 1;
- }
- if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) {
- location.y = GateEditPart.DEFAULT_SIZE.height - 2;// move fown
- } else {
- location.y = -GateEditPart.DEFAULT_SIZE.height + 2;// move up
- }
- } else if (PositionConstants.TOP == alignment) {
- location.y = -GateEditPart.DEFAULT_SIZE.height - 1;
- } else if (PositionConstants.BOTTOM == alignment) {
- location.y = GateEditPart.DEFAULT_SIZE.height + 1;
- }
- }
- }
- }
- return location;
- }
-
- @Override
- protected IParser createParser() {
- return new GateNameParser();
- }
-
- @Override
- protected IFigure createFigurePrim() {
- return new GateNameFigure();
- }
-
- public class GateNameParser extends MessageFormatParser implements ISemanticParser {
-
- /**
- * Constructor.
- *
- * @param features
- */
- public GateNameParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
- *
- * @param adapter
- * @param flags
- * @return
- */
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- // Object element = adapter.getAdapter(EObject.class);
- // if(element instanceof Gate) {
- // Gate gate = (Gate)element;
- // if(gate.eContainer() instanceof CombinedFragment) {
- // Gate outerGate = GateHelper.getOuterCFGate(gate);
- // if(outerGate != null) {
- // gate = outerGate;
- // }
- // } else if(gate.eContainer() instanceof Interaction) {
- // Gate actualGate = GateHelper.getActualGate(gate);
- // if(actualGate != null) {
- // gate = actualGate;
- // }
- // }
- // String printString = getPrintString(gate);
- // if(printString != null) {
- // return printString;
- // }
- // }
- return super.getPrintString(adapter, flags);
- }
-
- /**
- * @param gate
- */
- protected String getPrintString(Gate gate) {
- Message message = gate.getMessage();
- if (message != null) {
- MessageDirection direction = null;
- EObject parent = gate.eContainer();
- if (parent instanceof CombinedFragment) {
- CombinedFragment cf = ((CombinedFragment) parent);
- if (gate == message.getSendEvent()) {
- MessageEnd receiveEvent = message.getReceiveEvent();
- Lifeline lifeline = getCoveredBy(receiveEvent);
- if (!cf.getCovereds().contains(lifeline)) {
- direction = MessageDirection.OUT;
- }
- } else {
- MessageEnd sendEvent = message.getSendEvent();
- Lifeline coveredBy = getCoveredBy(sendEvent);
- if (!cf.getCovereds().contains(coveredBy)) {
- direction = MessageDirection.IN;
- }
- }
- } else if (parent instanceof Interaction) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.IN;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.OUT;
- }
- }
- if (direction == null) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.OUT;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.IN;
- }
- }
- if (direction != null) {
- StringBuffer buf = new StringBuffer();
- buf.append(direction.getName() + "_");
- buf.append(message.getName());
- return new String(buf);
- }
- }
- return null;
- }
-
- private Lifeline getCoveredBy(MessageEnd messageEnd) {
- if (messageEnd == null) {
- return null;
- }
- if (messageEnd instanceof OccurrenceSpecification) {
- return ((OccurrenceSpecification) messageEnd).getCovered();
- }
- return null;
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed(org.eclipse.emf.ecore.EObject)
- *
- * @param element
- * @return
- */
- @Override
- public List getSemanticElementsBeingParsed(EObject element) {
- if (element instanceof Gate) {
- return Collections.singletonList(element);
- }
- return Collections.emptyList();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected(org.eclipse.emf.ecore.EObject, java.lang.Object)
- *
- * @param listener
- * @param notification
- * @return
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
- }
-
- public class GateNameFigure extends WrappingLabel implements ILabelFigure, IPapyrusNodeUMLElementFigure {
-
- protected static final String LEFT_BRACE = "{";
-
- protected static final String RIGHT_BRACE = "}";
-
- private PapyrusWrappingLabel stereotypesLabel;
-
- private Label stereotypePropertiesLabel;
-
- /**
- * Constructor.
- *
- */
- public GateNameFigure() {
- setBorder(new MarginBorder(2));
- ToolbarLayout layout = new ToolbarLayout(false);
- layout.setStretchMinorAxis(true);
- setLayoutManager(layout);
- createContents();
- }
-
- protected void createContents() {
- setTextWrap(true);
- setAlignment(PositionConstants.CENTER);
- }
-
- @Override
- public void setStereotypeDisplay(String stereotypes, Image image) {
- if (stereotypes == null || stereotypes.trim().equals("")) {
- if (stereotypesLabel != null) {
- this.remove(stereotypesLabel);
- }
- stereotypesLabel = null;
- } else {
- if (stereotypesLabel == null) {
- stereotypesLabel = new PapyrusWrappingLabel(stereotypes, image);
- this.add(stereotypesLabel, 0);
- } else {
- stereotypesLabel.setText(stereotypes);
- stereotypesLabel.setIcon(image);
- }
- }
- }
-
-
- @Override
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- if (stereotypeProperties == null || stereotypeProperties.trim().equals("")) {
- if (stereotypePropertiesLabel != null) {
- this.remove(stereotypePropertiesLabel);
- }
- stereotypePropertiesLabel = null;
- } else {
- if (stereotypePropertiesLabel == null) {
- stereotypePropertiesLabel = new Label();
- int index = this.getChildren().indexOf(stereotypesLabel);
- this.add(stereotypePropertiesLabel, index + 1);
- }
- stereotypePropertiesLabel.setText(LEFT_BRACE + stereotypeProperties + RIGHT_BRACE);
- }
- }
-
-
- @Override
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
-
- }
-
-
- @Override
- public PapyrusWrappingLabel getStereotypesLabel() {
- return stereotypesLabel;
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.MarginBorder; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.ToolbarLayout; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure; +import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeExternalNodeLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.Gate; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageEnd; +import org.eclipse.uml2.uml.OccurrenceSpecification; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * 1. Refactoring with a BorderItemLabelEditPart. + * 2. Add displaying stereotypes. + * + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyrusEditPart { + + public static final String GATE_NAME_TYPE = "Gate_Name"; + + static { + registerSnapBackPosition(GATE_NAME_TYPE, new Point(-32, 0)); + } + + /** + * Constructor. + * + * @param view + */ + public GateNameEditPart(View view) { + super(view); + } + + @Override + public int getDirectEditionType() { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + + @Override + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + // Display stereotype on name figure. + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeLabelEditPolicy()); + } + + @Override + public IFigure getPrimaryShape() { + return getFigure(); + } + + @Override + public IBorderItemLocator getBorderItemLocator() { + IFigure parentFigure = getFigure().getParent(); + if (parentFigure != null && parentFigure.getLayoutManager() != null) { + Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); + return (IBorderItemLocator) constraint; + } + return null; + } + + @Override + protected Point getLocation() { + Point location = super.getLocation(); + if (location.x == 0 && location.y == 0) { + Dimension size = getSize(); + EditPart parent = getParent(); + if (parent instanceof GateEditPart) { + GateEditPart gateEditPart = ((GateEditPart) parent); + EObject elt = gateEditPart.resolveSemanticElement(); + Dimension preferredSize = getFigure().getPreferredSize(size.width, size.height); + IBorderItemLocator locator = gateEditPart.getBorderItemLocator(); + if (locator instanceof GateLocator) { + int alignment = ((GateLocator) locator).getAlignment(((GateLocator) locator).getConstraint()); + if (PositionConstants.LEFT == alignment) { + if (gateEditPart.getTargetConnections().isEmpty()) { + location.x = -preferredSize.width - 1; + } else { + location.x = GateEditPart.DEFAULT_SIZE.width + 1; + } + if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) { + location.y = GateEditPart.DEFAULT_SIZE.height - 2;// move fown + } else { + location.y = -GateEditPart.DEFAULT_SIZE.height + 2;// move up + } + } else if (PositionConstants.RIGHT == alignment) { + if (gateEditPart.getSourceConnections().isEmpty()) { + location.x = GateEditPart.DEFAULT_SIZE.width + 1; + } else { + location.x = -preferredSize.width - 1; + } + if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) { + location.y = GateEditPart.DEFAULT_SIZE.height - 2;// move fown + } else { + location.y = -GateEditPart.DEFAULT_SIZE.height + 2;// move up + } + } else if (PositionConstants.TOP == alignment) { + location.y = -GateEditPart.DEFAULT_SIZE.height - 1; + } else if (PositionConstants.BOTTOM == alignment) { + location.y = GateEditPart.DEFAULT_SIZE.height + 1; + } + } + } + } + return location; + } + + @Override + protected IParser createParser() { + return new GateNameParser(); + } + + @Override + protected IFigure createFigurePrim() { + return new GateNameFigure(); + } + + public class GateNameParser extends MessageFormatParser implements ISemanticParser { + + /** + * Constructor. + * + * @param features + */ + public GateNameParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + /** + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int) + * + * @param adapter + * @param flags + * @return + */ + @Override + public String getPrintString(IAdaptable adapter, int flags) { + // Object element = adapter.getAdapter(EObject.class); + // if(element instanceof Gate) { + // Gate gate = (Gate)element; + // if(gate.eContainer() instanceof CombinedFragment) { + // Gate outerGate = GateHelper.getOuterCFGate(gate); + // if(outerGate != null) { + // gate = outerGate; + // } + // } else if(gate.eContainer() instanceof Interaction) { + // Gate actualGate = GateHelper.getActualGate(gate); + // if(actualGate != null) { + // gate = actualGate; + // } + // } + // String printString = getPrintString(gate); + // if(printString != null) { + // return printString; + // } + // } + return super.getPrintString(adapter, flags); + } + + /** + * @param gate + */ + protected String getPrintString(Gate gate) { + Message message = gate.getMessage(); + if (message != null) { + MessageDirection direction = null; + EObject parent = gate.eContainer(); + if (parent instanceof CombinedFragment) { + CombinedFragment cf = ((CombinedFragment) parent); + if (gate == message.getSendEvent()) { + MessageEnd receiveEvent = message.getReceiveEvent(); + Lifeline lifeline = getCoveredBy(receiveEvent); + if (!cf.getCovereds().contains(lifeline)) { + direction = MessageDirection.OUT; + } + } else { + MessageEnd sendEvent = message.getSendEvent(); + Lifeline coveredBy = getCoveredBy(sendEvent); + if (!cf.getCovereds().contains(coveredBy)) { + direction = MessageDirection.IN; + } + } + } else if (parent instanceof Interaction) { + if (gate == message.getSendEvent()) { + direction = MessageDirection.IN; + } else if (gate == message.getReceiveEvent()) { + direction = MessageDirection.OUT; + } + } + if (direction == null) { + if (gate == message.getSendEvent()) { + direction = MessageDirection.OUT; + } else if (gate == message.getReceiveEvent()) { + direction = MessageDirection.IN; + } + } + if (direction != null) { + StringBuffer buf = new StringBuffer(); + buf.append(direction.getName() + "_"); + buf.append(UMLLabelInternationalization.getInstance().getLabel(message)); + return new String(buf); + } + } + return null; + } + + private Lifeline getCoveredBy(MessageEnd messageEnd) { + if (messageEnd == null) { + return null; + } + if (messageEnd instanceof OccurrenceSpecification) { + return ((OccurrenceSpecification) messageEnd).getCovered(); + } + return null; + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature); + } + + /** + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed(org.eclipse.emf.ecore.EObject) + * + * @param element + * @return + */ + @Override + public List getSemanticElementsBeingParsed(EObject element) { + if (element instanceof Gate) { + return Collections.singletonList(element); + } + return Collections.emptyList(); + } + + /** + * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected(org.eclipse.emf.ecore.EObject, java.lang.Object) + * + * @param listener + * @param notification + * @return + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + } + + public class GateNameFigure extends WrappingLabel implements ILabelFigure, IPapyrusNodeUMLElementFigure { + + protected static final String LEFT_BRACE = "{"; + + protected static final String RIGHT_BRACE = "}"; + + private PapyrusWrappingLabel stereotypesLabel; + + private Label stereotypePropertiesLabel; + + /** + * Constructor. + * + */ + public GateNameFigure() { + setBorder(new MarginBorder(2)); + ToolbarLayout layout = new ToolbarLayout(false); + layout.setStretchMinorAxis(true); + setLayoutManager(layout); + createContents(); + } + + protected void createContents() { + setTextWrap(true); + setAlignment(PositionConstants.CENTER); + } + + @Override + public void setStereotypeDisplay(String stereotypes, Image image) { + if (stereotypes == null || stereotypes.trim().equals("")) { + if (stereotypesLabel != null) { + this.remove(stereotypesLabel); + } + stereotypesLabel = null; + } else { + if (stereotypesLabel == null) { + stereotypesLabel = new PapyrusWrappingLabel(stereotypes, image); + this.add(stereotypesLabel, 0); + } else { + stereotypesLabel.setText(stereotypes); + stereotypesLabel.setIcon(image); + } + } + } + + + @Override + public void setStereotypePropertiesInBrace(String stereotypeProperties) { + if (stereotypeProperties == null || stereotypeProperties.trim().equals("")) { + if (stereotypePropertiesLabel != null) { + this.remove(stereotypePropertiesLabel); + } + stereotypePropertiesLabel = null; + } else { + if (stereotypePropertiesLabel == null) { + stereotypePropertiesLabel = new Label(); + int index = this.getChildren().indexOf(stereotypesLabel); + this.add(stereotypePropertiesLabel, index + 1); + } + stereotypePropertiesLabel.setText(LEFT_BRACE + stereotypeProperties + RIGHT_BRACE); + } + } + + + @Override + public void setStereotypePropertiesInCompartment(String stereotypeProperties) { + + } + + + @Override + public PapyrusWrappingLabel getStereotypesLabel() { + return stereotypesLabel; + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEndEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEndEditPart.java index 88a590aad06..7ed17487338 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEndEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEndEditPart.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2016 CEA LIST and others. - * + * * 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 @@ -8,7 +8,9 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 502155 + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 502155 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; @@ -91,6 +93,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.HighlightEditPolic import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper; import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Comment; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Message; @@ -251,7 +254,7 @@ public class MessageEndEditPart extends GraphicalEditPart implements INodeEditPa fig.setForegroundColor(ColorConstants.white); Label tooltip = new Label(); if (messageEnd != null) { - tooltip.setText(messageEnd.getName()); + tooltip.setText(UMLLabelInternationalization.getInstance().getLabel(messageEnd)); } fig.setToolTip(tooltip); fig.setOpaque(false); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java index bac84a0df19..05f9a572c59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java @@ -1,143 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for the InteractionUse. This parser of refreshing the text displayed by the
- * InteractionUse.
- */
-public class InteractionUseCustomParsers extends MessageFormatParser implements ISemanticParser {
-
- public InteractionUseCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public InteractionUseCustomParsers(EAttribute[] features) {
- super(features);
- }
-
- public InteractionUseCustomParsers() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent(java.lang.Object
- * , int)
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse
- * .core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
- if (obj instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse) obj;
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- String interactionName = interaction.getName();
- if (interactionName != null) {
- sb.append(interaction.getName());
- }
- }
- }
- return sb.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected
- * (org.eclipse.emf.ecore.EObject, java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed
- * (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse) element;
- semanticElementsBeingParsed.add(interactionUse);
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- // Add the interaction refered.
- semanticElementsBeingParsed.add(interaction);
- // TODO : Collaboration and interactionUse
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionUse; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A specific parser for the InteractionUse. This parser of refreshing the text displayed by the + * InteractionUse. + */ +public class InteractionUseCustomParsers extends MessageFormatParser implements ISemanticParser { + + public InteractionUseCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public InteractionUseCustomParsers(EAttribute[] features) { + super(features); + } + + public InteractionUseCustomParsers() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent(java.lang.Object + * , int) + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse + * .core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + StringBuffer sb = new StringBuffer(); + if (obj instanceof InteractionUse) { + InteractionUse interactionUse = (InteractionUse) obj; + Interaction interaction = interactionUse.getRefersTo(); + if (interaction != null) { + String interactionName = UMLLabelInternationalization.getInstance().getLabel(interaction); + if (interactionName != null) { + sb.append(interactionName); + } + } + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected + * (org.eclipse.emf.ecore.EObject, java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed + * (org.eclipse.emf.ecore.EObject) + */ + @Override + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof InteractionUse) { + InteractionUse interactionUse = (InteractionUse) element; + semanticElementsBeingParsed.add(interactionUse); + Interaction interaction = interactionUse.getRefersTo(); + if (interaction != null) { + // Add the interaction refered. + semanticElementsBeingParsed.add(interaction); + // TODO : Collaboration and interactionUse + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java index da04af3c041..3a7b7fac12b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java @@ -1,194 +1,196 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Expression;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.LiteralSpecification;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.PartDecomposition;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for the Lifeline header. This parser of refreshing the text displayed by the
- * lifeline.
- */
-public class LifelineCustomParsers extends MessageFormatParser implements ISemanticParser {
-
- public LifelineCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public LifelineCustomParsers(EAttribute[] features) {
- super(features);
- }
-
- public LifelineCustomParsers() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * Information identifying the lifeline displayed inside the rectangle
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
- if (obj instanceof Lifeline) {
- Lifeline lifeline = (Lifeline) obj;
- ConnectableElement connectableElement = lifeline.getRepresents();
- ValueSpecification selector = lifeline.getSelector();
- if (connectableElement != null) {
- // Add ConnectableElement Name
- String connectableElementName = connectableElement.getName();
- if (connectableElementName != null) {
- sb.append(connectableElementName);
- }
- // Add the selector if it is a LiteralSpecification
- if (selector instanceof LiteralSpecification) {
- sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector)).append("]");
- }
- // Add the type name
- Type type = connectableElement.getType();
- if (type != null && type.getName() != null && type.getName().length() > 0) {
- sb.append(" : ").append(type.getName());
- }
- }
- // Add the selector if it is an Expression
- if (selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) {
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector);
- if (specificationValue != null && specificationValue.length() > 0) {
- sb.append("\n").append(specificationValue);
- }
- }
- // Add the decomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if (partDecomposition != null) {
- Interaction refersTo = partDecomposition.getRefersTo();
- if (refersTo != null) {
- sb.append("\nref ").append(refersTo.getName());
- }
- }
- // LifelineIndent cannot be empty so if the stringBuffer is empty we add the name of the
- // lifeline
- // This case occurs when creating the lifeline for example
- if (sb.length() == 0) {
- sb.append(lifeline.getName());
- }
- }
- return sb.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected
- * (org.eclipse.emf.ecore.EObject, java.lang.Object)
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed
- * (org.eclipse.emf.ecore.EObject)
- */
- @Override
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Lifeline) {
- Lifeline lifeline = (Lifeline) element;
- // Add the lifeline
- semanticElementsBeingParsed.add(lifeline);
- // Add the selector
- if (lifeline.getSelector() != null) {
- semanticElementsBeingParsed.add(lifeline.getSelector());
- }
- // Add the partDecomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if (partDecomposition != null) {
- semanticElementsBeingParsed.add(partDecomposition);
- // Add the Interaction refered by the partDecomposition
- if (partDecomposition.getRefersTo() != null) {
- semanticElementsBeingParsed.add(partDecomposition.getRefersTo());
- }
- }
- // Add the connectableElement and its type if it has any
- ConnectableElement connectableElement = lifeline.getRepresents();
- if (connectableElement != null) {
- semanticElementsBeingParsed.add(connectableElement);
- if (connectableElement.getType() != null) {
- semanticElementsBeingParsed.add(connectableElement.getType());
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(feature)
- || UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralBoolean_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature)
- || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Selector().equals(feature) || UMLPackage.eINSTANCE.getLifeline_DecomposedAs().equals(feature)
- || UMLPackage.eINSTANCE.getLifeline_Represents().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.ConnectableElement; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Expression; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.LiteralSpecification; +import org.eclipse.uml2.uml.OpaqueExpression; +import org.eclipse.uml2.uml.PartDecomposition; +import org.eclipse.uml2.uml.TimeExpression; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * A specific parser for the Lifeline header. This parser of refreshing the text displayed by the + * lifeline. + */ +public class LifelineCustomParsers extends MessageFormatParser implements ISemanticParser { + + public LifelineCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public LifelineCustomParsers(EAttribute[] features) { + super(features); + } + + public LifelineCustomParsers() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * Information identifying the lifeline displayed inside the rectangle + * + * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int) + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object obj = element.getAdapter(EObject.class); + StringBuffer sb = new StringBuffer(); + if (obj instanceof Lifeline) { + Lifeline lifeline = (Lifeline) obj; + ConnectableElement connectableElement = lifeline.getRepresents(); + ValueSpecification selector = lifeline.getSelector(); + if (connectableElement != null) { + // Add ConnectableElement Name + String connectableElementName = UMLLabelInternationalization.getInstance().getLabel(connectableElement); + if (connectableElementName != null) { + sb.append(connectableElementName); + } + // Add the selector if it is a LiteralSpecification + if (selector instanceof LiteralSpecification) { + sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector, true)).append("]"); + } + // Add the type name + Type type = connectableElement.getType(); + if (type != null && type.getName() != null && UMLLabelInternationalization.getInstance().getLabel(type).length() > 0) { + sb.append(" : ").append(UMLLabelInternationalization.getInstance().getLabel(type)); + } + } + // Add the selector if it is an Expression + if (selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) { + String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector); + if (specificationValue != null && specificationValue.length() > 0) { + sb.append("\n").append(specificationValue); + } + } + // Add the decomposition + PartDecomposition partDecomposition = lifeline.getDecomposedAs(); + if (partDecomposition != null) { + Interaction refersTo = partDecomposition.getRefersTo(); + if (refersTo != null) { + sb.append("\nref ").append(UMLLabelInternationalization.getInstance().getLabel(refersTo)); + } + } + // LifelineIndent cannot be empty so if the stringBuffer is empty we add the name of the + // lifeline + // This case occurs when creating the lifeline for example + if (sb.length() == 0) { + sb.append(UMLLabelInternationalization.getInstance().getLabel(lifeline)); + } + } + return sb.toString(); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected + * (org.eclipse.emf.ecore.EObject, java.lang.Object) + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed + * (org.eclipse.emf.ecore.EObject) + */ + @Override + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Lifeline) { + Lifeline lifeline = (Lifeline) element; + // Add the lifeline + semanticElementsBeingParsed.add(lifeline); + // Add the selector + if (lifeline.getSelector() != null) { + semanticElementsBeingParsed.add(lifeline.getSelector()); + } + // Add the partDecomposition + PartDecomposition partDecomposition = lifeline.getDecomposedAs(); + if (partDecomposition != null) { + semanticElementsBeingParsed.add(partDecomposition); + // Add the Interaction refered by the partDecomposition + if (partDecomposition.getRefersTo() != null) { + semanticElementsBeingParsed.add(partDecomposition.getRefersTo()); + } + } + // Add the connectableElement and its type if it has any + ConnectableElement connectableElement = lifeline.getRepresents(); + if (connectableElement != null) { + semanticElementsBeingParsed.add(connectableElement); + if (connectableElement.getType() != null) { + semanticElementsBeingParsed.add(connectableElement.getType()); + } + } + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(feature) + || UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralBoolean_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) + || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Selector().equals(feature) || UMLPackage.eINSTANCE.getLifeline_DecomposedAs().equals(feature) + || UMLPackage.eINSTANCE.getLifeline_Represents().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java index 8cf4267d8c4..b47af51b3cf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java @@ -1,107 +1,109 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.OperationUtil;
-import org.eclipse.papyrus.uml.tools.utils.SignalUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class MessageCustomParser extends MessageFormatParser implements ISemanticParser {
-
- public MessageCustomParser(EAttribute[] features) {
- super(features);
- }
-
- public MessageCustomParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public MessageCustomParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- String result = null;
- if (obj instanceof Message) {
- Message message = (Message) obj;
- NamedElement signature = message.getSignature();
- if (signature instanceof Operation) {
- Operation operation = (Operation) signature;
- if (MessageSort.REPLY_LITERAL.equals(message.getMessageSort())) {
- result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_RT_TYPE));
- } else if (MessageSort.SYNCH_CALL_LITERAL.equals(message.getMessageSort())) {
- result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE));
- } else {
- result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE, ICustomAppearance.DISP_RT_TYPE));
- }
- } else if (signature instanceof Signal) {
- result = SignalUtil.getCustomLabel((Signal) signature, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE));
- } else if (signature != null) {
- result = signature.getName();
- }
- // If the String is empty, we add the name of the message
- if (result == null || result.equals("")) {
- result = message.getName();
- }
- }
- return result;
- }
-
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
- @Override
- public List<Element> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof Message) {
- Message message = (Message) element;
- semanticElementsBeingParsed.add(message);
- NamedElement signature = message.getSignature();
- semanticElementsBeingParsed.add(signature);
- if (signature instanceof Operation) {
- for (Parameter parameter : ((Operation) signature).getOwnedParameters()) {
- semanticElementsBeingParsed.add(parameter);
- }
- }
- if (signature instanceof Signal) {
- for (Property property : ((Signal) signature).getOwnedAttributes()) {
- semanticElementsBeingParsed.add(property);
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parser.custom; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.OperationUtil; +import org.eclipse.papyrus.uml.tools.utils.SignalUtil; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageSort; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Signal; +import org.eclipse.uml2.uml.UMLPackage; + +public class MessageCustomParser extends MessageFormatParser implements ISemanticParser { + + public MessageCustomParser(EAttribute[] features) { + super(features); + } + + public MessageCustomParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + public MessageCustomParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + @Override + public String getPrintString(IAdaptable adapter, int flags) { + Object obj = adapter.getAdapter(EObject.class); + String result = null; + if (obj instanceof Message) { + Message message = (Message) obj; + NamedElement signature = message.getSignature(); + if (signature instanceof Operation) { + Operation operation = (Operation) signature; + if (MessageSort.REPLY_LITERAL.equals(message.getMessageSort())) { + result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_RT_TYPE)); + } else if (MessageSort.SYNCH_CALL_LITERAL.equals(message.getMessageSort())) { + result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE)); + } else { + result = OperationUtil.getCustomLabel(operation, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE, ICustomAppearance.DISP_RT_TYPE)); + } + } else if (signature instanceof Signal) { + result = SignalUtil.getCustomLabel((Signal) signature, Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE)); + } else if (signature != null) { + result = UMLLabelInternationalization.getInstance().getLabel(signature); + } + // If the String is empty, we add the name of the message + if (result == null || result.equals("")) { + result = UMLLabelInternationalization.getInstance().getLabel(message); + } + } + return result; + } + + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + return true; + } + + @Override + public List<Element> getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof Message) { + Message message = (Message) element; + semanticElementsBeingParsed.add(message); + NamedElement signature = message.getSignature(); + semanticElementsBeingParsed.add(signature); + if (signature instanceof Operation) { + for (Parameter parameter : ((Operation) signature).getOwnedParameters()) { + semanticElementsBeingParsed.add(parameter); + } + } + if (signature instanceof Signal) { + for (Property property : ((Signal) signature).getOwnedAttributes()) { + semanticElementsBeingParsed.add(property); + } + } + } + return semanticElementsBeingParsed; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java index 60615cf84c7..0f208e634df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java @@ -1,279 +1,280 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Duration;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Interval;
-import org.eclipse.uml2.uml.LiteralInteger;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Specific Parser for the TimeConstraint and DurationConstraint.
- */
-public class TimeConstraintParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a line break */
- private static final String LINE_BREAK = System.getProperty("line.separator");
-
- /** The format for displaying time constraint text */
- private static final String FORMAT = "{%s}";
-
- public TimeConstraintParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public TimeConstraintParser(EAttribute[] features) {
- super(features);
- }
-
- public TimeConstraintParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object adapter = element.getAdapter(EObject.class);
- if (adapter instanceof TimeConstraint) {
- TimeConstraint constraint = (TimeConstraint) adapter;
- ValueSpecification spec = constraint.getSpecification();
- return String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec));
- } else if (adapter instanceof DurationConstraint) {
- String value = getDurationConstraint((DurationConstraint) adapter);
- return String.format(FORMAT, value);
- } else if (adapter instanceof Message) {
- StringBuffer result = new StringBuffer();
- Message message = (Message) adapter;
- MessageEnd event1 = message.getSendEvent();
- MessageEnd event2 = message.getReceiveEvent();
- List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2);
- for (DurationConstraint constraint : constraints) {
- if (result.length() > 0) {
- result.append(LINE_BREAK);
- }
- ValueSpecification spec = constraint.getSpecification();
- result.append(String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec)));
- }
- return result.toString();
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public List getSemanticElementsBeingParsed(EObject element) {
- HashSet<Element> semanticElementsBeingParsed = new HashSet<Element>();
- if (element instanceof Constraint) {
- Constraint constraint = (Constraint) element;
- ValueSpecificationUtil.addEnclosedValueSpecificationToCollection(constraint.getSpecification(), semanticElementsBeingParsed);
- } else if (element instanceof Message) {
- Message message = (Message) element;
- semanticElementsBeingParsed.add(message);
- MessageEnd event1 = message.getSendEvent();
- semanticElementsBeingParsed.add(event1);
- MessageEnd event2 = message.getReceiveEvent();
- semanticElementsBeingParsed.add(event2);
- List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2);
- for (DurationConstraint constraint : constraints) {
- semanticElementsBeingParsed.add(constraint);
- // owner for listening DurationConstraint deletion
- semanticElementsBeingParsed.add(constraint.getOwner());
- }
- }
- return new ArrayList(semanticElementsBeingParsed);
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass());
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- if (element instanceof DurationConstraint) {
- return getDurationConstraint((DurationConstraint) element);
- }
- return super.getEditString(adapter, flags);
- }
-
- protected String getDurationConstraint(DurationConstraint constraint) {
- ValueSpecification spec = constraint.getSpecification();
- if (spec instanceof Interval) {
- Interval interval = (Interval) spec;
- String min = ValueSpecificationUtil.getSpecificationValue(interval.getMin());
- String max = ValueSpecificationUtil.getSpecificationValue(interval.getMax());
- if (min.equals(max)) {
- return min;
- }
- }
- String value = ValueSpecificationUtil.getSpecificationValue(spec);
- return value;
- }
-
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- if (element instanceof DurationConstraint) {
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- Object[] values = parseInterval(newString);
- if (values == null || values.length != 2) {
- return UnexecutableCommand.INSTANCE;
- }
- return new UpdateDurationConstraintCommand(editingDomain, (DurationConstraint) element, values[0], values[1]);
- }
- return super.getParseCommand(adapter, newString, flags);
- }
-
- private Object[] parseInterval(String newString) {
- int pos = newString.indexOf("..");
- if (pos > -1) {
- String[] part = { newString.substring(0, pos), newString.substring(pos + 2) };
- try {
- int min = Integer.parseInt(part[0].trim());
- int max = Integer.parseInt(part[1].trim());
- return new Integer[] { min, max };
- } catch (Exception e) {
- }
- return part;
- } else {
- try {
- int value = Integer.parseInt(newString);
- return new Integer[] { value, value };
- } catch (Exception e) {
- }
- // same value for min and max
- return new String[] { newString, newString };
- }
- }
-
- static class UpdateDurationConstraintCommand extends AbstractTransactionalCommand {
-
- private DurationConstraint constraint;
-
- private Object min;
-
- private Object max;
-
- public UpdateDurationConstraintCommand(TransactionalEditingDomain domain, DurationConstraint constraint, Object min, Object max) {
- super(domain, "Set Values", null);
- this.constraint = constraint;
- this.min = min;
- this.max = max;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ValueSpecification spec = constraint.getSpecification();
- if (spec instanceof Interval) {
- Interval interval = (Interval) spec;
- setValue(interval.getMin(), min);
- setValue(interval.getMax(), max);
- }
- return CommandResult.newOKCommandResult();
- }
-
- private void setValue(ValueSpecification spec, Object val) {
- if (spec instanceof Duration) {
- Duration dur = (Duration) spec;
- if (dur.getExpr() instanceof LiteralInteger && val instanceof Integer) {
- ((LiteralInteger) dur.getExpr()).setValue((Integer) val);
- } else {
- LiteralString str = UMLFactory.eINSTANCE.createLiteralString();
- str.setValue(val.toString());
- dur.setExpr(str);
- }
- }
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parser.custom; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Duration; +import org.eclipse.uml2.uml.DurationConstraint; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Interval; +import org.eclipse.uml2.uml.LiteralInteger; +import org.eclipse.uml2.uml.LiteralString; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageEnd; +import org.eclipse.uml2.uml.TimeConstraint; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * Specific Parser for the TimeConstraint and DurationConstraint. + */ +public class TimeConstraintParser extends MessageFormatParser implements ISemanticParser { + + /** The String for displaying a line break */ + private static final String LINE_BREAK = System.getProperty("line.separator"); + + /** The format for displaying time constraint text */ + private static final String FORMAT = "{%s}"; + + public TimeConstraintParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + public TimeConstraintParser(EAttribute[] features) { + super(features); + } + + public TimeConstraintParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * Gets the e structural feature. + * + * @param notification + * @return the structural feature + */ + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + Object adapter = element.getAdapter(EObject.class); + if (adapter instanceof TimeConstraint) { + TimeConstraint constraint = (TimeConstraint) adapter; + ValueSpecification spec = constraint.getSpecification(); + return String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec, true)); + } else if (adapter instanceof DurationConstraint) { + String value = getDurationConstraint((DurationConstraint) adapter, true); + return String.format(FORMAT, value); + } else if (adapter instanceof Message) { + StringBuffer result = new StringBuffer(); + Message message = (Message) adapter; + MessageEnd event1 = message.getSendEvent(); + MessageEnd event2 = message.getReceiveEvent(); + List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2); + for (DurationConstraint constraint : constraints) { + if (result.length() > 0) { + result.append(LINE_BREAK); + } + ValueSpecification spec = constraint.getSpecification(); + result.append(String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec, true))); + } + return result.toString(); + } + return ""; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List getSemanticElementsBeingParsed(EObject element) { + HashSet<Element> semanticElementsBeingParsed = new HashSet<Element>(); + if (element instanceof Constraint) { + Constraint constraint = (Constraint) element; + ValueSpecificationUtil.addEnclosedValueSpecificationToCollection(constraint.getSpecification(), semanticElementsBeingParsed); + } else if (element instanceof Message) { + Message message = (Message) element; + semanticElementsBeingParsed.add(message); + MessageEnd event1 = message.getSendEvent(); + semanticElementsBeingParsed.add(event1); + MessageEnd event2 = message.getReceiveEvent(); + semanticElementsBeingParsed.add(event2); + List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2); + for (DurationConstraint constraint : constraints) { + semanticElementsBeingParsed.add(constraint); + // owner for listening DurationConstraint deletion + semanticElementsBeingParsed.add(constraint.getOwner()); + } + } + return new ArrayList(semanticElementsBeingParsed); + } + + /** + * Determines if the given feature has to be taken into account in this parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass()); + } + + @Override + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + if (element instanceof DurationConstraint) { + return getDurationConstraint((DurationConstraint) element, false); + } + return super.getEditString(adapter, flags); + } + + protected String getDurationConstraint(DurationConstraint constraint, final boolean useInternationalization) { + ValueSpecification spec = constraint.getSpecification(); + if (spec instanceof Interval) { + Interval interval = (Interval) spec; + String min = ValueSpecificationUtil.getSpecificationValue(interval.getMin(), useInternationalization); + String max = ValueSpecificationUtil.getSpecificationValue(interval.getMax(), useInternationalization); + if (min.equals(max)) { + return min; + } + } + String value = ValueSpecificationUtil.getSpecificationValue(spec, useInternationalization); + return value; + } + + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + if (element instanceof DurationConstraint) { + TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + Object[] values = parseInterval(newString); + if (values == null || values.length != 2) { + return UnexecutableCommand.INSTANCE; + } + return new UpdateDurationConstraintCommand(editingDomain, (DurationConstraint) element, values[0], values[1]); + } + return super.getParseCommand(adapter, newString, flags); + } + + private Object[] parseInterval(String newString) { + int pos = newString.indexOf(".."); + if (pos > -1) { + String[] part = { newString.substring(0, pos), newString.substring(pos + 2) }; + try { + int min = Integer.parseInt(part[0].trim()); + int max = Integer.parseInt(part[1].trim()); + return new Integer[] { min, max }; + } catch (Exception e) { + } + return part; + } else { + try { + int value = Integer.parseInt(newString); + return new Integer[] { value, value }; + } catch (Exception e) { + } + // same value for min and max + return new String[] { newString, newString }; + } + } + + static class UpdateDurationConstraintCommand extends AbstractTransactionalCommand { + + private DurationConstraint constraint; + + private Object min; + + private Object max; + + public UpdateDurationConstraintCommand(TransactionalEditingDomain domain, DurationConstraint constraint, Object min, Object max) { + super(domain, "Set Values", null); + this.constraint = constraint; + this.min = min; + this.max = max; + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ValueSpecification spec = constraint.getSpecification(); + if (spec instanceof Interval) { + Interval interval = (Interval) spec; + setValue(interval.getMin(), min); + setValue(interval.getMax(), max); + } + return CommandResult.newOKCommandResult(); + } + + private void setValue(ValueSpecification spec, Object val) { + if (spec instanceof Duration) { + Duration dur = (Duration) spec; + if (dur.getExpr() instanceof LiteralInteger && val instanceof Integer) { + ((LiteralInteger) dur.getExpr()).setValue((Integer) val); + } else { + LiteralString str = UMLFactory.eINSTANCE.createLiteralString(); + str.setValue(val.toString()); + dur.setExpr(str); + } + } + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java index d75eade6baf..2af1fcda473 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java @@ -1,124 +1,127 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Specific Parser for the TimeObservation.
- */
-public class TimeObservationParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a time observation */
- private static final String FORMAT = "@%s";
-
- public TimeObservationParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public TimeObservationParser(EAttribute[] features) {
- super(features);
- }
-
- public TimeObservationParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- StringBuffer result = new StringBuffer();
- Object adapter = element.getAdapter(EObject.class);
- if (adapter instanceof TimeObservation) {
- TimeObservation observation = (TimeObservation) adapter;
- if (observation.getName() != null) {
- return String.format(FORMAT, observation.getName());
- }
- }
- return result.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if (element instanceof TimeObservation) {
- semanticElementsBeingParsed.add((TimeObservation) element);
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parser.custom; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.TimeObservation; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Specific Parser for the TimeObservation. + */ +public class TimeObservationParser extends MessageFormatParser implements ISemanticParser { + + /** The String for displaying a time observation */ + private static final String FORMAT = "@%s"; + + public TimeObservationParser() { + super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }); + } + + public TimeObservationParser(EAttribute[] features) { + super(features); + } + + public TimeObservationParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * Gets the e structural feature. + * + * @param notification + * @return the structural feature + */ + protected EStructuralFeature getEStructuralFeature(Object notification) { + EStructuralFeature featureImpl = null; + if (notification instanceof Notification) { + Object feature = ((Notification) notification).getFeature(); + if (feature instanceof EStructuralFeature) { + featureImpl = (EStructuralFeature) feature; + } + } + return featureImpl; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAffectingEvent(Object event, int flags) { + EStructuralFeature feature = getEStructuralFeature(event); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + public String getPrintString(IAdaptable element, int flags) { + StringBuffer result = new StringBuffer(); + Object adapter = element.getAdapter(EObject.class); + if (adapter instanceof TimeObservation) { + TimeObservation observation = (TimeObservation) adapter; + final String observationLabel = UMLLabelInternationalization.getInstance().getLabel(observation); + if (observationLabel != null) { + return String.format(FORMAT, observationLabel); + } + } + return result.toString(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean areSemanticElementsAffected(EObject listener, Object notification) { + EStructuralFeature feature = getEStructuralFeature(notification); + return isValidFeature(feature); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("unchecked") + public List getSemanticElementsBeingParsed(EObject element) { + List<Element> semanticElementsBeingParsed = new ArrayList<Element>(); + if (element instanceof TimeObservation) { + semanticElementsBeingParsed.add((TimeObservation) element); + } + return semanticElementsBeingParsed; + } + + /** + * Determines if the given feature has to be taken into account in this parser + * + * @param feature + * the feature to test + * @return true if is valid, false otherwise + */ + private boolean isValidFeature(EStructuralFeature feature) { + return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/GateHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/GateHelper.java index 2c7a2534a6d..493c86316bf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/GateHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/GateHelper.java @@ -1,559 +1,561 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EAnnotation;
-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.RollbackException;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.TransactionalCommandStack;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class GateHelper {
-
- private static final String CF_GATE_DATA = "CombinedFragment.InnerGate";
-
- private static final String CF_GATE_INSIDE = "insideCF";
-
- private static final String CF_GATE_OUTSIDE = "outsideCF";
-
- private static final String GATE_NAME_VOLATILE = "Gate.name.volatile";
-
- /**
- * Constructor.
- *
- */
- private GateHelper() {
- }
-
- /**
- * Create and add View for Gate.
- *
- * @param containerView
- * @param gate
- * @param innerGate
- * for CombinedFragment.
- * @return
- */
- public static View createView(View containerView, Gate gate) {
- if (containerView == null || gate == null) {
- return null;
- }
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setType(GateEditPart.GATE_TYPE);
- node.setElement(gate);
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- ViewUtil.insertChildView(containerView, node, ViewUtil.APPEND, true);
- // label
- DecorationNode label = NotationFactory.eINSTANCE.createDecorationNode();
- label.setType(GateNameEditPart.GATE_NAME_TYPE);
- // Add possible to move the label.
- label.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- ViewUtil.insertChildView(node, label, ViewUtil.APPEND, true);
- return node;
- }
-
- /**
- * Constraints:
- * 1. The message leading to/from an actualGate of an InteractionUse must correspond to the message leading from/to the
- * formalGate with the same name of the Interaction referenced by the InteractionUse.
- * 2. The message leading to/from an (expression) Gate within a CombinedFragment must correspond to the message leading
- * from/to the CombinedFragment on its outside.
- */
- public static Gate createGate(Element parent, boolean createInnerCFGate) {
- if (parent == null) {
- return null;
- }
- String name = generateGateName(parent, "gate");
- Gate gate = null;
- if (parent instanceof Interaction) {
- gate = ((Interaction) parent).getFormalGate(name, false, true);
- } else if (parent instanceof CombinedFragment) {
- gate = ((CombinedFragment) parent).getCfragmentGate(name, false, true);
- if (createInnerCFGate) {
- Gate innerGate = ((CombinedFragment) parent).createCfragmentGate(generateGateName(parent, "gate"));
- EAnnotation ann = innerGate.createEAnnotation(CF_GATE_DATA);
- ann.getDetails().put(CF_GATE_OUTSIDE, getIdentification(gate));
- ann = gate.createEAnnotation(CF_GATE_DATA);
- ann.getDetails().put(CF_GATE_INSIDE, getIdentification(innerGate));
- // setVolatile(innerGate, true);
- }
- // setVolatile(gate, true);
- } else if (parent instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse) parent;
- Interaction refersTo = interactionUse.getRefersTo();
- if (refersTo != null) {
- refersTo.getFormalGate(name, false, true);
- }
- gate = interactionUse.getActualGate(name, false, true);
- }
- return gate;
- }
-
- protected static String getIdentification(Gate gate) {
- if (gate == null) {
- return null;
- }
- if (gate.eResource() != null) {
- return gate.eResource().getURIFragment(gate);
- } else {
- return gate.getName();
- }
- }
-
- protected static Gate findGate(CombinedFragment cf, String identification) {
- if (cf == null || identification == null) {
- return null;
- }
- if (cf.eResource() != null) {
- EObject eObject = cf.eResource().getEObject(identification);
- if (eObject instanceof Gate) {
- return (Gate) eObject;
- }
- }
- return cf.getCfragmentGate(identification);
- }
-
- public static Gate getInnerCFGate(Gate outerGate) {
- if (outerGate == null || !(outerGate.eContainer() instanceof CombinedFragment)) {
- return null;
- }
- CombinedFragment cf = (CombinedFragment) outerGate.eContainer();
- EAnnotation ann = outerGate.getEAnnotation(CF_GATE_DATA);
- if (ann != null) {
- String name = ann.getDetails().get(CF_GATE_INSIDE);
- return findGate(cf, name);
- }
- return null;
- }
-
- public static Gate getOuterCFGate(Gate innerGate) {
- if (innerGate == null || !(innerGate.eContainer() instanceof CombinedFragment)) {
- return null;
- }
- CombinedFragment cf = (CombinedFragment) innerGate.eContainer();
- EAnnotation ann = innerGate.getEAnnotation(CF_GATE_DATA);
- if (ann != null) {
- String name = ann.getDetails().get(CF_GATE_OUTSIDE);
- return findGate(cf, name);
- }
- return null;
- }
-
- public static boolean isInnerCFGate(Gate gate) {
- if (gate == null || !(gate.eContainer() instanceof CombinedFragment)) {
- return false;
- }
- CombinedFragment cf = (CombinedFragment) gate.eContainer();
- EAnnotation ann = gate.getEAnnotation(CF_GATE_DATA);
- if (ann != null) {
- String name = ann.getDetails().get(CF_GATE_OUTSIDE);
- return findGate(cf, name) != null;
- }
- return false;
- }
-
- public static Message getOuterCFMessage(Message message) {
- if (message == null) {
- return null;
- }
- MessageEnd sendEvent = message.getSendEvent();
- if (sendEvent instanceof Gate) {
- Gate gate = (Gate) sendEvent;
- if (!isInnerCFGate(gate)) {
- return null;
- }
- Gate outerGate = getOuterCFGate(gate);
- if (outerGate != null) {
- return outerGate.getMessage();
- }
- }
- MessageEnd receiveEvent = message.getReceiveEvent();
- if (receiveEvent instanceof Gate) {
- Gate gate = (Gate) receiveEvent;
- if (!isInnerCFGate(gate)) {
- return null;
- }
- Gate outerGate = getOuterCFGate(gate);
- if (outerGate != null) {
- return outerGate.getMessage();
- }
- }
- return null;
- }
-
- public static Gate getActualGate(Gate gate) {
- if (gate == null || !(gate.eContainer() instanceof Interaction)) {
- return null;
- }
- Interaction interaction = (Interaction) gate.eContainer();
- List<InteractionUse> refersToBy = findRefersToBy(interaction);
- for (InteractionUse interactionUse : refersToBy) {
- Gate actualGate = interactionUse.getActualGate(gate.getName());
- if (actualGate != null) {
- return actualGate;
- }
- }
- return null;
- }
-
- public static List<InteractionUse> findRefersToBy(Interaction interaction) {
- if (interaction == null) {
- return Collections.emptyList();
- }
- List<InteractionUse> refersToBy = new ArrayList<InteractionUse>();
- Resource eResource = interaction.eResource();
- if (eResource != null) {
- ResourceSet resourceSet = eResource.getResourceSet();
- if (resourceSet != null) {
- EList<Resource> resources = resourceSet.getResources();
- for (Resource resource : resources) {
- TreeIterator<EObject> contents = resource.getAllContents();
- while (contents.hasNext()) {
- EObject next = contents.next();
- if (next instanceof InteractionUse && interaction == ((InteractionUse) next).getRefersTo()) {
- refersToBy.add((InteractionUse) next);
- }
- }
- }
- } else {
- TreeIterator<EObject> contents = eResource.getAllContents();
- while (contents.hasNext()) {
- EObject next = contents.next();
- if (next instanceof InteractionUse && interaction == ((InteractionUse) next).getRefersTo()) {
- refersToBy.add((InteractionUse) next);
- }
- }
- }
- } else {
- EList<InteractionFragment> fragments = interaction.getFragments();
- for (InteractionFragment fragment : fragments) {
- if (!(fragment instanceof InteractionUse)) {
- continue;
- }
- if (interaction == ((InteractionUse) fragment).getRefersTo()) {
- refersToBy.add(((InteractionUse) fragment));
- }
- }
- }
- return refersToBy;
- }
-
- /**
- * Generate name for Gate.
- *
- * @param container
- * @param object
- * @param direction
- * @return
- */
- public static String generateGateName(EObject container, String suffix) {
- // Update gate name to hold a global sequence number.
- int index = getTotalGatesNumber(container);
- String name = suffix;
- if (container instanceof Interaction) {
- Interaction interaction = (Interaction) container;
- if (!"gate".equals(suffix) && interaction.getFormalGate(suffix) == null) {
- return suffix;
- }
- String gateName = name + index;
- while (interaction.getFormalGate(gateName = name + index) != null) {
- index++;
- }
- name = gateName;
- } else if (container instanceof InteractionUse) {
- InteractionUse iUse = (InteractionUse) container;
- if (!"gate".equals(suffix) && iUse.getActualGate(suffix) == null) {
- return suffix;
- }
- String gateName = name + index;
- while (iUse.getActualGate(gateName = name + index) != null) {
- index++;
- }
- name = gateName;
- } else if (container instanceof CombinedFragment) {
- CombinedFragment cf = (CombinedFragment) container;
- if (!"gate".equals(suffix) && cf.getCfragmentGate(suffix) == null) {
- return suffix;
- }
- String gateName = name + index;
- while (cf.getCfragmentGate(gateName = name + index) != null) {
- index++;
- }
- name = gateName;
- }
- return name;
- }
-
- private static int getTotalGatesNumber(EObject parent) {
- // fixed bug: start count for each Interaction.
- Interaction interaction = getRootInteraction(parent);
- if (interaction == null) {
- return 0;
- }
- int size = 0;
- TreeIterator<EObject> allContents = interaction.eAllContents();
- while (allContents.hasNext()) {
- if (allContents.next() instanceof Gate) {
- size++;
- }
- }
- return size;
- }
-
- private static Interaction getRootInteraction(EObject eObj) {
- if (eObj == null) {
- return null;
- } else if (eObj instanceof Interaction) {
- return (Interaction) eObj;
- }
- return getRootInteraction(eObj.eContainer());
- }
-
- public static Point computeGateLocation(Point pt, IFigure hostFigure, IFigure gateFigure) {
- if (pt == null || hostFigure == null) {
- return pt;
- }
- Point location = pt.getCopy();
- Rectangle bounds = new Rectangle(location, GateEditPart.DEFAULT_SIZE);
- hostFigure.translateToRelative(bounds);
- GateLocator locator = new GateLocator(hostFigure);
- Rectangle validLocation = locator.getValidLocation(bounds, gateFigure);
- return validLocation.getLocation().getTranslated(0, -GateEditPart.DEFAULT_SIZE.height / 2 - 1);
- }
-
- public static void updateGateName(TransactionalEditingDomain editingDomain, final Gate gate, final String newName) {
- if (gate == null) {
- return;
- }
- String name = gate.getName();
- if (name == null && newName == null) {
- return;
- } else if (name != null && name.equals(newName)) {
- return;
- } else {
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "", null) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- gate.setName(newName);
- return CommandResult.newOKCommandResult();
- }
- };
- CommandStack commandStack = editingDomain.getCommandStack();
- GMFtoEMFCommandWrapper command = new GMFtoEMFCommandWrapper(cmd);
- if (commandStack instanceof TransactionalCommandStack) {
- try {
- ((TransactionalCommandStack) commandStack).execute(command, Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (RollbackException e) {
- e.printStackTrace();
- }
- } else {
- commandStack.execute(command);
- }
- }
- }
-
- public static String getGateLabel(Gate gate) {
- Message message = gate.getMessage();
- if (message != null) {
- MessageDirection direction = null;
- EObject parent = gate.eContainer();
- if (parent instanceof CombinedFragment) {
- CombinedFragment cf = ((CombinedFragment) parent);
- if (gate == message.getSendEvent()) {
- MessageEnd receiveEvent = message.getReceiveEvent();
- Lifeline lifeline = getCoveredBy(receiveEvent);
- if (!cf.getCovereds().contains(lifeline)) {
- direction = MessageDirection.OUT;
- } else {
- direction = MessageDirection.IN;
- }
- } else {
- MessageEnd sendEvent = message.getSendEvent();
- Lifeline coveredBy = getCoveredBy(sendEvent);
- if (!cf.getCovereds().contains(coveredBy)) {
- direction = MessageDirection.IN;
- } else {
- direction = MessageDirection.OUT;
- }
- }
- } else if (parent instanceof Interaction) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.IN;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.OUT;
- }
- }
- if (direction == null) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.OUT;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.IN;
- }
- }
- if (direction != null) {
- StringBuffer buf = new StringBuffer();
- buf.append(direction.getName() + "_");
- buf.append(message.getName());
- return new String(buf);
- }
- }
- return gate.getLabel();
- }
-
- private static Lifeline getCoveredBy(MessageEnd messageEnd) {
- if (messageEnd == null) {
- return null;
- }
- if (messageEnd instanceof OccurrenceSpecification) {
- return ((OccurrenceSpecification) messageEnd).getCovered();
- }
- return null;
- }
-
- public static void setVolatile(Gate gate, boolean value) {
- if (gate == null) {
- return;
- }
- EAnnotation annotation = gate.getEAnnotation(GATE_NAME_VOLATILE);
- if (true == value) {
- if (annotation == null) {
- annotation = gate.createEAnnotation(GATE_NAME_VOLATILE);
- }
- annotation.getDetails().put(GATE_NAME_VOLATILE, Boolean.toString(value));
- } else if (annotation != null) {
- gate.getEAnnotations().remove(annotation);
- }
- if (gate.eContainer() instanceof InteractionUse) {
- Interaction refersTo = ((InteractionUse) gate.eContainer()).getRefersTo();
- if (refersTo != null) {
- Gate formalGate = refersTo.getFormalGate(gate.getName());
- if (formalGate != null) {
- setVolatile(formalGate, value);
- }
- }
- } else if (!GateHelper.isInnerCFGate(gate)) {
- Gate innerGate = GateHelper.getInnerCFGate(gate);
- if (innerGate != null) {
- setVolatile(innerGate, value);
- }
- }
- }
-
- public static boolean isVolatile(Gate gate) {
- if (gate == null) {
- return false;
- }
- EAnnotation ann = gate.getEAnnotation(GATE_NAME_VOLATILE);
- return ann != null;
- }
-
- public static void updateGateWithMessage(Message message, boolean force) {
- if (message == null) {
- return;
- }
- MessageEnd sendEvent = message.getSendEvent();
- MessageEnd receiveEvent = message.getReceiveEvent();
- // Suggest a name for gate with message.
- if (sendEvent instanceof Gate) {
- Gate gate = (Gate) sendEvent;
- updateGateName(gate, force);
- }
- if (receiveEvent instanceof Gate) {
- Gate gate = (Gate) receiveEvent;
- updateGateName(gate, force);
- }
- }
-
- protected static void updateGateName(Gate gate, boolean force) {
- if (gate == null) {
- return;
- }
- if (gate.eContainer() instanceof InteractionUse) {
- Interaction refersTo = ((InteractionUse) gate.eContainer()).getRefersTo();
- if (refersTo != null) {
- Gate formalGate = refersTo.getFormalGate(gate.getName());
- if (formalGate != null && isVolatile(formalGate)) {
- formalGate.setName(GateHelper.getGateLabel(gate));
- if (force) {
- setVolatile(formalGate, false);
- }
- }
- } else if (isVolatile(gate)) {
- gate.setName(GateHelper.getGateLabel(gate));
- if (force) {
- setVolatile(gate, false);
- }
- }
- } else if (!GateHelper.isInnerCFGate(gate)) {
- String newName = GateHelper.getGateLabel(gate);
- if (isVolatile(gate)) {
- gate.setName(newName);
- }
- Gate innerGate = GateHelper.getInnerCFGate(gate);
- if (innerGate != null && (isVolatile(innerGate))) {
- innerGate.setName(newName);
- if (force) {
- setVolatile(innerGate, false);
- }
- }
- if (force) {
- setVolatile(gate, false);
- }
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Soyatec - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EAnnotation; +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.RollbackException; +import org.eclipse.emf.transaction.Transaction; +import org.eclipse.emf.transaction.TransactionalCommandStack; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.notation.DecorationNode; +import org.eclipse.gmf.runtime.notation.NotationFactory; +import org.eclipse.gmf.runtime.notation.Shape; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Gate; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionFragment; +import org.eclipse.uml2.uml.InteractionUse; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageEnd; +import org.eclipse.uml2.uml.OccurrenceSpecification; + +/** + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class GateHelper { + + private static final String CF_GATE_DATA = "CombinedFragment.InnerGate"; + + private static final String CF_GATE_INSIDE = "insideCF"; + + private static final String CF_GATE_OUTSIDE = "outsideCF"; + + private static final String GATE_NAME_VOLATILE = "Gate.name.volatile"; + + /** + * Constructor. + * + */ + private GateHelper() { + } + + /** + * Create and add View for Gate. + * + * @param containerView + * @param gate + * @param innerGate + * for CombinedFragment. + * @return + */ + public static View createView(View containerView, Gate gate) { + if (containerView == null || gate == null) { + return null; + } + Shape node = NotationFactory.eINSTANCE.createShape(); + node.setType(GateEditPart.GATE_TYPE); + node.setElement(gate); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + ViewUtil.insertChildView(containerView, node, ViewUtil.APPEND, true); + // label + DecorationNode label = NotationFactory.eINSTANCE.createDecorationNode(); + label.setType(GateNameEditPart.GATE_NAME_TYPE); + // Add possible to move the label. + label.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + ViewUtil.insertChildView(node, label, ViewUtil.APPEND, true); + return node; + } + + /** + * Constraints: + * 1. The message leading to/from an actualGate of an InteractionUse must correspond to the message leading from/to the + * formalGate with the same name of the Interaction referenced by the InteractionUse. + * 2. The message leading to/from an (expression) Gate within a CombinedFragment must correspond to the message leading + * from/to the CombinedFragment on its outside. + */ + public static Gate createGate(Element parent, boolean createInnerCFGate) { + if (parent == null) { + return null; + } + String name = generateGateName(parent, "gate"); + Gate gate = null; + if (parent instanceof Interaction) { + gate = ((Interaction) parent).getFormalGate(name, false, true); + } else if (parent instanceof CombinedFragment) { + gate = ((CombinedFragment) parent).getCfragmentGate(name, false, true); + if (createInnerCFGate) { + Gate innerGate = ((CombinedFragment) parent).createCfragmentGate(generateGateName(parent, "gate")); + EAnnotation ann = innerGate.createEAnnotation(CF_GATE_DATA); + ann.getDetails().put(CF_GATE_OUTSIDE, getIdentification(gate)); + ann = gate.createEAnnotation(CF_GATE_DATA); + ann.getDetails().put(CF_GATE_INSIDE, getIdentification(innerGate)); + // setVolatile(innerGate, true); + } + // setVolatile(gate, true); + } else if (parent instanceof InteractionUse) { + InteractionUse interactionUse = (InteractionUse) parent; + Interaction refersTo = interactionUse.getRefersTo(); + if (refersTo != null) { + refersTo.getFormalGate(name, false, true); + } + gate = interactionUse.getActualGate(name, false, true); + } + return gate; + } + + protected static String getIdentification(Gate gate) { + if (gate == null) { + return null; + } + if (gate.eResource() != null) { + return gate.eResource().getURIFragment(gate); + } else { + return gate.getName(); + } + } + + protected static Gate findGate(CombinedFragment cf, String identification) { + if (cf == null || identification == null) { + return null; + } + if (cf.eResource() != null) { + EObject eObject = cf.eResource().getEObject(identification); + if (eObject instanceof Gate) { + return (Gate) eObject; + } + } + return cf.getCfragmentGate(identification); + } + + public static Gate getInnerCFGate(Gate outerGate) { + if (outerGate == null || !(outerGate.eContainer() instanceof CombinedFragment)) { + return null; + } + CombinedFragment cf = (CombinedFragment) outerGate.eContainer(); + EAnnotation ann = outerGate.getEAnnotation(CF_GATE_DATA); + if (ann != null) { + String name = ann.getDetails().get(CF_GATE_INSIDE); + return findGate(cf, name); + } + return null; + } + + public static Gate getOuterCFGate(Gate innerGate) { + if (innerGate == null || !(innerGate.eContainer() instanceof CombinedFragment)) { + return null; + } + CombinedFragment cf = (CombinedFragment) innerGate.eContainer(); + EAnnotation ann = innerGate.getEAnnotation(CF_GATE_DATA); + if (ann != null) { + String name = ann.getDetails().get(CF_GATE_OUTSIDE); + return findGate(cf, name); + } + return null; + } + + public static boolean isInnerCFGate(Gate gate) { + if (gate == null || !(gate.eContainer() instanceof CombinedFragment)) { + return false; + } + CombinedFragment cf = (CombinedFragment) gate.eContainer(); + EAnnotation ann = gate.getEAnnotation(CF_GATE_DATA); + if (ann != null) { + String name = ann.getDetails().get(CF_GATE_OUTSIDE); + return findGate(cf, name) != null; + } + return false; + } + + public static Message getOuterCFMessage(Message message) { + if (message == null) { + return null; + } + MessageEnd sendEvent = message.getSendEvent(); + if (sendEvent instanceof Gate) { + Gate gate = (Gate) sendEvent; + if (!isInnerCFGate(gate)) { + return null; + } + Gate outerGate = getOuterCFGate(gate); + if (outerGate != null) { + return outerGate.getMessage(); + } + } + MessageEnd receiveEvent = message.getReceiveEvent(); + if (receiveEvent instanceof Gate) { + Gate gate = (Gate) receiveEvent; + if (!isInnerCFGate(gate)) { + return null; + } + Gate outerGate = getOuterCFGate(gate); + if (outerGate != null) { + return outerGate.getMessage(); + } + } + return null; + } + + public static Gate getActualGate(Gate gate) { + if (gate == null || !(gate.eContainer() instanceof Interaction)) { + return null; + } + Interaction interaction = (Interaction) gate.eContainer(); + List<InteractionUse> refersToBy = findRefersToBy(interaction); + for (InteractionUse interactionUse : refersToBy) { + Gate actualGate = interactionUse.getActualGate(gate.getName()); + if (actualGate != null) { + return actualGate; + } + } + return null; + } + + public static List<InteractionUse> findRefersToBy(Interaction interaction) { + if (interaction == null) { + return Collections.emptyList(); + } + List<InteractionUse> refersToBy = new ArrayList<InteractionUse>(); + Resource eResource = interaction.eResource(); + if (eResource != null) { + ResourceSet resourceSet = eResource.getResourceSet(); + if (resourceSet != null) { + EList<Resource> resources = resourceSet.getResources(); + for (Resource resource : resources) { + TreeIterator<EObject> contents = resource.getAllContents(); + while (contents.hasNext()) { + EObject next = contents.next(); + if (next instanceof InteractionUse && interaction == ((InteractionUse) next).getRefersTo()) { + refersToBy.add((InteractionUse) next); + } + } + } + } else { + TreeIterator<EObject> contents = eResource.getAllContents(); + while (contents.hasNext()) { + EObject next = contents.next(); + if (next instanceof InteractionUse && interaction == ((InteractionUse) next).getRefersTo()) { + refersToBy.add((InteractionUse) next); + } + } + } + } else { + EList<InteractionFragment> fragments = interaction.getFragments(); + for (InteractionFragment fragment : fragments) { + if (!(fragment instanceof InteractionUse)) { + continue; + } + if (interaction == ((InteractionUse) fragment).getRefersTo()) { + refersToBy.add(((InteractionUse) fragment)); + } + } + } + return refersToBy; + } + + /** + * Generate name for Gate. + * + * @param container + * @param object + * @param direction + * @return + */ + public static String generateGateName(EObject container, String suffix) { + // Update gate name to hold a global sequence number. + int index = getTotalGatesNumber(container); + String name = suffix; + if (container instanceof Interaction) { + Interaction interaction = (Interaction) container; + if (!"gate".equals(suffix) && interaction.getFormalGate(suffix) == null) { + return suffix; + } + String gateName = name + index; + while (interaction.getFormalGate(gateName = name + index) != null) { + index++; + } + name = gateName; + } else if (container instanceof InteractionUse) { + InteractionUse iUse = (InteractionUse) container; + if (!"gate".equals(suffix) && iUse.getActualGate(suffix) == null) { + return suffix; + } + String gateName = name + index; + while (iUse.getActualGate(gateName = name + index) != null) { + index++; + } + name = gateName; + } else if (container instanceof CombinedFragment) { + CombinedFragment cf = (CombinedFragment) container; + if (!"gate".equals(suffix) && cf.getCfragmentGate(suffix) == null) { + return suffix; + } + String gateName = name + index; + while (cf.getCfragmentGate(gateName = name + index) != null) { + index++; + } + name = gateName; + } + return name; + } + + private static int getTotalGatesNumber(EObject parent) { + // fixed bug: start count for each Interaction. + Interaction interaction = getRootInteraction(parent); + if (interaction == null) { + return 0; + } + int size = 0; + TreeIterator<EObject> allContents = interaction.eAllContents(); + while (allContents.hasNext()) { + if (allContents.next() instanceof Gate) { + size++; + } + } + return size; + } + + private static Interaction getRootInteraction(EObject eObj) { + if (eObj == null) { + return null; + } else if (eObj instanceof Interaction) { + return (Interaction) eObj; + } + return getRootInteraction(eObj.eContainer()); + } + + public static Point computeGateLocation(Point pt, IFigure hostFigure, IFigure gateFigure) { + if (pt == null || hostFigure == null) { + return pt; + } + Point location = pt.getCopy(); + Rectangle bounds = new Rectangle(location, GateEditPart.DEFAULT_SIZE); + hostFigure.translateToRelative(bounds); + GateLocator locator = new GateLocator(hostFigure); + Rectangle validLocation = locator.getValidLocation(bounds, gateFigure); + return validLocation.getLocation().getTranslated(0, -GateEditPart.DEFAULT_SIZE.height / 2 - 1); + } + + public static void updateGateName(TransactionalEditingDomain editingDomain, final Gate gate, final String newName) { + if (gate == null) { + return; + } + String name = gate.getName(); + if (name == null && newName == null) { + return; + } else if (name != null && name.equals(newName)) { + return; + } else { + AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "", null) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + gate.setName(newName); + return CommandResult.newOKCommandResult(); + } + }; + CommandStack commandStack = editingDomain.getCommandStack(); + GMFtoEMFCommandWrapper command = new GMFtoEMFCommandWrapper(cmd); + if (commandStack instanceof TransactionalCommandStack) { + try { + ((TransactionalCommandStack) commandStack).execute(command, Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE)); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (RollbackException e) { + e.printStackTrace(); + } + } else { + commandStack.execute(command); + } + } + } + + public static String getGateLabel(Gate gate) { + Message message = gate.getMessage(); + if (message != null) { + MessageDirection direction = null; + EObject parent = gate.eContainer(); + if (parent instanceof CombinedFragment) { + CombinedFragment cf = ((CombinedFragment) parent); + if (gate == message.getSendEvent()) { + MessageEnd receiveEvent = message.getReceiveEvent(); + Lifeline lifeline = getCoveredBy(receiveEvent); + if (!cf.getCovereds().contains(lifeline)) { + direction = MessageDirection.OUT; + } else { + direction = MessageDirection.IN; + } + } else { + MessageEnd sendEvent = message.getSendEvent(); + Lifeline coveredBy = getCoveredBy(sendEvent); + if (!cf.getCovereds().contains(coveredBy)) { + direction = MessageDirection.IN; + } else { + direction = MessageDirection.OUT; + } + } + } else if (parent instanceof Interaction) { + if (gate == message.getSendEvent()) { + direction = MessageDirection.IN; + } else if (gate == message.getReceiveEvent()) { + direction = MessageDirection.OUT; + } + } + if (direction == null) { + if (gate == message.getSendEvent()) { + direction = MessageDirection.OUT; + } else if (gate == message.getReceiveEvent()) { + direction = MessageDirection.IN; + } + } + if (direction != null) { + StringBuffer buf = new StringBuffer(); + buf.append(direction.getName() + "_"); + buf.append(UMLLabelInternationalization.getInstance().getLabel(message)); + return new String(buf); + } + } + return gate.getLabel(); + } + + private static Lifeline getCoveredBy(MessageEnd messageEnd) { + if (messageEnd == null) { + return null; + } + if (messageEnd instanceof OccurrenceSpecification) { + return ((OccurrenceSpecification) messageEnd).getCovered(); + } + return null; + } + + public static void setVolatile(Gate gate, boolean value) { + if (gate == null) { + return; + } + EAnnotation annotation = gate.getEAnnotation(GATE_NAME_VOLATILE); + if (true == value) { + if (annotation == null) { + annotation = gate.createEAnnotation(GATE_NAME_VOLATILE); + } + annotation.getDetails().put(GATE_NAME_VOLATILE, Boolean.toString(value)); + } else if (annotation != null) { + gate.getEAnnotations().remove(annotation); + } + if (gate.eContainer() instanceof InteractionUse) { + Interaction refersTo = ((InteractionUse) gate.eContainer()).getRefersTo(); + if (refersTo != null) { + Gate formalGate = refersTo.getFormalGate(gate.getName()); + if (formalGate != null) { + setVolatile(formalGate, value); + } + } + } else if (!GateHelper.isInnerCFGate(gate)) { + Gate innerGate = GateHelper.getInnerCFGate(gate); + if (innerGate != null) { + setVolatile(innerGate, value); + } + } + } + + public static boolean isVolatile(Gate gate) { + if (gate == null) { + return false; + } + EAnnotation ann = gate.getEAnnotation(GATE_NAME_VOLATILE); + return ann != null; + } + + public static void updateGateWithMessage(Message message, boolean force) { + if (message == null) { + return; + } + MessageEnd sendEvent = message.getSendEvent(); + MessageEnd receiveEvent = message.getReceiveEvent(); + // Suggest a name for gate with message. + if (sendEvent instanceof Gate) { + Gate gate = (Gate) sendEvent; + updateGateName(gate, force); + } + if (receiveEvent instanceof Gate) { + Gate gate = (Gate) receiveEvent; + updateGateName(gate, force); + } + } + + protected static void updateGateName(Gate gate, boolean force) { + if (gate == null) { + return; + } + if (gate.eContainer() instanceof InteractionUse) { + Interaction refersTo = ((InteractionUse) gate.eContainer()).getRefersTo(); + if (refersTo != null) { + Gate formalGate = refersTo.getFormalGate(gate.getName()); + if (formalGate != null && isVolatile(formalGate)) { + formalGate.setName(GateHelper.getGateLabel(gate)); + if (force) { + setVolatile(formalGate, false); + } + } + } else if (isVolatile(gate)) { + gate.setName(GateHelper.getGateLabel(gate)); + if (force) { + setVolatile(gate, false); + } + } + } else if (!GateHelper.isInnerCFGate(gate)) { + String newName = GateHelper.getGateLabel(gate); + if (isVolatile(gate)) { + gate.setName(newName); + } + Gate innerGate = GateHelper.getInnerCFGate(gate); + if (innerGate != null && (isVolatile(innerGate))) { + innerGate.setName(newName); + if (force) { + setVolatile(innerGate, false); + } + } + if (force) { + setVolatile(gate, false); + } + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineLabelHelper.java index 8ecb37daed7..b1ae2883c3b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineLabelHelper.java @@ -1,179 +1,193 @@ -package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart;
-import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Expression;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.LiteralSpecification;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-public class LifelineLabelHelper extends StereotypedElementLabelHelper {
-
- public static final String SHOW_REPRESENT_NAME = "representsName";
-
- public static final String SHOW_REPRESENT_SELECTOR = "representsSelector";
-
- public static final String SHOW_REPRESENT_TYPE = "representsType";
-
- public static final String SHOW_UNDEFINED_TYPE = "undefinedType";
-
- public static final String SHOW_LIFELINE_NAME = "lifelineName";
-
- public static final Collection<String> DEFAULT_LABEL_DISPLAY = Arrays.asList(SHOW_REPRESENT_NAME, SHOW_REPRESENT_SELECTOR, SHOW_REPRESENT_TYPE);
-
- /**
- * singelton instance
- */
- private static LifelineLabelHelper labelHelper;
-
- /**
- * Returns the singleton instance of this class
- *
- * @return the singleton instance.
- */
- public static LifelineLabelHelper getInstance() {
- if (labelHelper == null) {
- labelHelper = new LifelineLabelHelper();
- }
- return labelHelper;
- }
-
- /** Map for masks */
- protected final Map<String, String> masks = new HashMap<String, String>();
-
- /**
- * Creates a new Operation label helper.
- */
- protected LifelineLabelHelper() {
- // initialize the map
- masks.put(SHOW_REPRESENT_NAME, "Show represent name");
- masks.put(SHOW_REPRESENT_SELECTOR, "Show represent selector");
- masks.put(SHOW_REPRESENT_TYPE, "Show represent type");
- masks.put(SHOW_UNDEFINED_TYPE, "Always show undefined type");
- masks.put(SHOW_LIFELINE_NAME, "Always show lifeline name");
- }
-
- /**
- * Returns the map of masks used to display
- *
- * @return the map of masks used to display
- */
- public Map<String, String> getMasks() {
- return masks;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Lifeline getUMLElement(GraphicalEditPart editPart) {
- return (Lifeline) UMLUtil.resolveUMLElement(editPart);
- }
-
- @Override
- protected String elementLabel(GraphicalEditPart editPart) {
- if (editPart instanceof LifelineNameEditPart) {
- editPart = (GraphicalEditPart) editPart.getParent();
- }
- Collection<String> displayValue = DEFAULT_LABEL_DISPLAY;
- IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (policy != null) {
- displayValue = policy.getCurrentDisplayValue();
- }
- return getCustomLabel(getUMLElement(editPart), displayValue);
- }
-
- private static final String UNAMED = "<Unnamed>";
-
- private static final String UNDEFINED = "<Undefined>";
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=383722
- private String getCustomLabel(Lifeline lifeline, Collection<String> displayValue) {
- StringBuilder sb = new StringBuilder();
- appendName(lifeline, displayValue, sb);
- boolean displayType = displayValue.contains(SHOW_REPRESENT_TYPE);
- if (lifeline.getRepresents() == null || displayValue.contains(LifelineLabelHelper.SHOW_LIFELINE_NAME)) {
- displayType = false;
- }
- if (displayType) {
- // handle represent type label
- appendType(lifeline, displayValue, sb);
- }
- return sb.toString();
- }
-
- protected void appendName(Lifeline lifeline, Collection<String> displayValue, StringBuilder sb) {
- ConnectableElement element = lifeline.getRepresents();
- String lifelineName = lifeline.getName();
- if (element == null || displayValue.contains(SHOW_LIFELINE_NAME)) {
- appendString(sb, lifelineName, UNAMED);
- return;
- } else {
- // represents is not null
- if (displayValue.contains(SHOW_REPRESENT_NAME)) {
- appendString(sb, element.getName(), UNAMED);
- boolean displaySelector = displayValue.contains(SHOW_REPRESENT_SELECTOR);
- if (lifeline.getRepresents() == null || displayValue.contains(LifelineLabelHelper.SHOW_LIFELINE_NAME)) {
- displaySelector = false;
- }
- if (displaySelector) {
- ValueSpecification selector = lifeline.getSelector();
- // Add the selector if it is a LiteralSpecification
- if(selector instanceof LiteralSpecification) {
- sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector)).append("]");
- }
- // Add the selector if it is an Expression
- if(selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) {
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector);
- if(specificationValue != null && specificationValue.length() > 0) {
- sb.append("[").append(specificationValue).append("]");
- }
- }
- }
- }
- // if neither <1> or <2> are checked, show lifeline name (or <unnamed> when the lifeline has no name)
- else if (!displayValue.contains(SHOW_REPRESENT_TYPE)) {
- appendString(sb, lifelineName, UNAMED);
- }
- }
- }
-
- protected void appendType(Lifeline lifeline, Collection<String> displayValue, StringBuilder sb) {
- ConnectableElement element = lifeline.getRepresents();
- if (element == null) {
- return;
- }
- Type type = element.getType();
- if (displayValue.contains(SHOW_REPRESENT_TYPE)) {
- if (type == null) {
- if (displayValue.contains(SHOW_UNDEFINED_TYPE)) {
- sb.append(":").append(UNDEFINED);
- }
- } else {
- appendString(sb.append(":"), type.getName(), UNAMED);
- }
- }
- }
-
- private void appendString(StringBuilder sb, String str, String defaultValue) {
- if (str != null) {
- sb.append(str);
- } else {
- sb.append(defaultValue);
- }
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.UMLUtil; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.ConnectableElement; +import org.eclipse.uml2.uml.Expression; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.LiteralSpecification; +import org.eclipse.uml2.uml.OpaqueExpression; +import org.eclipse.uml2.uml.TimeExpression; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.ValueSpecification; + +public class LifelineLabelHelper extends StereotypedElementLabelHelper { + + public static final String SHOW_REPRESENT_NAME = "representsName"; + + public static final String SHOW_REPRESENT_SELECTOR = "representsSelector"; + + public static final String SHOW_REPRESENT_TYPE = "representsType"; + + public static final String SHOW_UNDEFINED_TYPE = "undefinedType"; + + public static final String SHOW_LIFELINE_NAME = "lifelineName"; + + public static final Collection<String> DEFAULT_LABEL_DISPLAY = Arrays.asList(SHOW_REPRESENT_NAME, SHOW_REPRESENT_SELECTOR, SHOW_REPRESENT_TYPE); + + /** + * singelton instance + */ + private static LifelineLabelHelper labelHelper; + + /** + * Returns the singleton instance of this class + * + * @return the singleton instance. + */ + public static LifelineLabelHelper getInstance() { + if (labelHelper == null) { + labelHelper = new LifelineLabelHelper(); + } + return labelHelper; + } + + /** Map for masks */ + protected final Map<String, String> masks = new HashMap<String, String>(); + + /** + * Creates a new Operation label helper. + */ + protected LifelineLabelHelper() { + // initialize the map + masks.put(SHOW_REPRESENT_NAME, "Show represent name"); + masks.put(SHOW_REPRESENT_SELECTOR, "Show represent selector"); + masks.put(SHOW_REPRESENT_TYPE, "Show represent type"); + masks.put(SHOW_UNDEFINED_TYPE, "Always show undefined type"); + masks.put(SHOW_LIFELINE_NAME, "Always show lifeline name"); + } + + /** + * Returns the map of masks used to display + * + * @return the map of masks used to display + */ + public Map<String, String> getMasks() { + return masks; + } + + /** + * {@inheritDoc} + */ + @Override + public Lifeline getUMLElement(GraphicalEditPart editPart) { + return (Lifeline) UMLUtil.resolveUMLElement(editPart); + } + + @Override + protected String elementLabel(GraphicalEditPart editPart) { + if (editPart instanceof LifelineNameEditPart) { + editPart = (GraphicalEditPart) editPart.getParent(); + } + Collection<String> displayValue = DEFAULT_LABEL_DISPLAY; + IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy) editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (policy != null) { + displayValue = policy.getCurrentDisplayValue(); + } + return getCustomLabel(getUMLElement(editPart), displayValue); + } + + private static final String UNAMED = "<Unnamed>"; + + private static final String UNDEFINED = "<Undefined>"; + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=383722 + private String getCustomLabel(Lifeline lifeline, Collection<String> displayValue) { + StringBuilder sb = new StringBuilder(); + appendName(lifeline, displayValue, sb); + boolean displayType = displayValue.contains(SHOW_REPRESENT_TYPE); + if (lifeline.getRepresents() == null || displayValue.contains(LifelineLabelHelper.SHOW_LIFELINE_NAME)) { + displayType = false; + } + if (displayType) { + // handle represent type label + appendType(lifeline, displayValue, sb); + } + return sb.toString(); + } + + protected void appendName(Lifeline lifeline, Collection<String> displayValue, StringBuilder sb) { + ConnectableElement element = lifeline.getRepresents(); + String lifelineName = UMLLabelInternationalization.getInstance().getLabel(lifeline); + if (element == null || displayValue.contains(SHOW_LIFELINE_NAME)) { + appendString(sb, lifelineName, UNAMED); + return; + } else { + // represents is not null + if (displayValue.contains(SHOW_REPRESENT_NAME)) { + appendString(sb,UMLLabelInternationalization.getInstance().getLabel( element), UNAMED); + boolean displaySelector = displayValue.contains(SHOW_REPRESENT_SELECTOR); + if (lifeline.getRepresents() == null || displayValue.contains(LifelineLabelHelper.SHOW_LIFELINE_NAME)) { + displaySelector = false; + } + if (displaySelector) { + ValueSpecification selector = lifeline.getSelector(); + // Add the selector if it is a LiteralSpecification + if(selector instanceof LiteralSpecification) { + sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector, true)).append("]"); + } + // Add the selector if it is an Expression + if(selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) { + String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector, true); + if(specificationValue != null && specificationValue.length() > 0) { + sb.append("[").append(specificationValue).append("]"); + } + } + } + } + // if neither <1> or <2> are checked, show lifeline name (or <unnamed> when the lifeline has no name) + else if (!displayValue.contains(SHOW_REPRESENT_TYPE)) { + appendString(sb, lifelineName, UNAMED); + } + } + } + + protected void appendType(Lifeline lifeline, Collection<String> displayValue, StringBuilder sb) { + ConnectableElement element = lifeline.getRepresents(); + if (element == null) { + return; + } + Type type = element.getType(); + if (displayValue.contains(SHOW_REPRESENT_TYPE)) { + if (type == null) { + if (displayValue.contains(SHOW_UNDEFINED_TYPE)) { + sb.append(":").append(UNDEFINED); + } + } else { + appendString(sb.append(":"), UMLLabelInternationalization.getInstance().getLabel(type), UNAMED); + } + } + } + + private void appendString(StringBuilder sb, String str, String defaultValue) { + if (str != null) { + sb.append(str); + } else { + sb.append(defaultValue); + } + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java index f77bb72df9c..0a7fe86c9a6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java @@ -1,247 +1,249 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.ExecutionSpecification;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-/**
- * Helper class for determine the message connections. Both for connecting and reconnecting.
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class MessageConnectionHelper {
-
- public static boolean debug = false;
-
- private MessageConnectionHelper() {
- }
-
- public static Element getMessageTarget(Message message) {
- Element target = null;
- MessageEnd receiveEvent = message.getReceiveEvent();
- if (receiveEvent instanceof OccurrenceSpecification) {
- EList<Lifeline> covereds = ((OccurrenceSpecification) receiveEvent).getCovereds();
- if (!covereds.isEmpty()) {
- target = covereds.get(0);
- }
- } else if (receiveEvent instanceof Gate
- // special handling of SyncMessages due to #425666
- && MessageSort.SYNCH_CALL_LITERAL != message.getMessageSort()) {
- target = ((Gate) receiveEvent).getOwner();
- }
- return target;
- }
-
- public static Element getMessageSource(Message message) {
- Element source = null;
- MessageEnd sendEvent = message.getSendEvent();
- if (sendEvent instanceof OccurrenceSpecification) {
- EList<Lifeline> covereds = ((OccurrenceSpecification) sendEvent).getCovereds();
- if (!covereds.isEmpty()) {
- source = covereds.get(0);
- }
- } else if (sendEvent instanceof Gate
- // special handling of SyncMessages due to #425666
- && MessageSort.SYNCH_CALL_LITERAL != message.getMessageSort()) {
- source = ((Gate) sendEvent).getOwner();
- }
- return source;
- }
-
- public static boolean canReorientSource(Message message, Element newSource) {
- if (message == null || newSource == null) {
- return false;
- }
- return canExist(message, newSource, getMessageTarget(message));
- }
-
- public static boolean canReorientTarget(Message message, Element newTarget) {
- if (message == null || newTarget == null) {
- return false;
- }
- return canExist(message, getMessageSource(message), newTarget);
- }
-
- public static boolean canExist(Message message, Element source, Element target) {
- MessageSort messageSort = null;
- if (message != null) {
- messageSort = message.getMessageSort();
- }
- return canExist(message, messageSort, source, target);
- }
-
- public static boolean canExist(Message message, MessageSort messageSort, Element source, Element target) {
- if (debug) {
- print(messageSort, source, target);
- }
- if (MessageSort.ASYNCH_CALL_LITERAL == messageSort) {
- return canExistAsynchMessage(message, source, target);
- } else if (MessageSort.ASYNCH_SIGNAL_LITERAL == messageSort) {
- if (source == null) {
- return canExistFoundMessage(message, target);
- }
- if (target == null) {
- return canExistLostMessage(message, source);
- }
- } else if (MessageSort.SYNCH_CALL_LITERAL == messageSort) {
- return canExistSynchMessage(message, source, target);
- } else if (MessageSort.CREATE_MESSAGE_LITERAL == messageSort) {
- return canExistCreateMessage(message, source, target);
- } else if (MessageSort.DELETE_MESSAGE_LITERAL == messageSort) {
- return canExistDeleteMessage(message, source, target);
- } else if (MessageSort.REPLY_LITERAL == messageSort) {
- return canExistReplyMessage(message, source, target);
- }
- return false;
- }
-
- public static boolean canExist(MessageSort messageSort, Element source, Element target) {
- return canExist(null, messageSort, source, target);
- }
-
- private static void print(MessageSort messageSort, Element source, Element target) {
- StringBuffer buf = new StringBuffer();
- if (messageSort != null) {
- buf.append(messageSort.getName());
- buf.append("[");
- }
- buf.append("Source: ");
- if (source != null) {
- buf.append(source.eClass().getName());
- if (source instanceof NamedElement) {
- buf.append("(");
- buf.append(((NamedElement) source).getName());
- buf.append(")");
- }
- } else {
- buf.append("null");
- }
- buf.append(", Target: ");
- if (target != null) {
- buf.append(target.eClass().getName());
- if (target instanceof NamedElement) {
- buf.append("(");
- buf.append(((NamedElement) target).getName());
- buf.append(")");
- }
- } else {
- buf.append("null");
- }
- buf.append("]");
- System.out.println(new String(buf));
- }
-
- public static boolean canExistReplyMessage(Message message, Element source, Element target) {
- if (target instanceof Message) {
- return false;
- }
- if (source instanceof ExecutionSpecification && target instanceof Lifeline) {
- if (((ExecutionSpecification) source).getCovereds().contains(target)) {
- return false;
- }
- }
- if (target instanceof Gate) {
- Message ownMessage = ((Gate) target).getMessage();
- if (ownMessage == null) {
- return true;
- }
- return ownMessage == message;
- }
- return true;
- }
-
- public static boolean canExistDeleteMessage(Message message, Element source, Element target) {
- return true;
- }
-
- public static boolean canExistCreateMessage(Message message, Element source, Element target) {
- if (target != null) {
- if (false == target instanceof Lifeline) {
- return false;
- }
- if (target == source) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean canExistSynchMessage(Message message, Element source, Element target) {
- if (target instanceof Message) {
- return false;
- }
- if (source != null && !(source instanceof ExecutionSpecification || source instanceof Lifeline || source instanceof ExecutionOccurrenceSpecification || source instanceof MessageEnd)) {
- return false;
- }
- if (target != null && !(target instanceof ExecutionSpecification || target instanceof Lifeline || target instanceof ExecutionOccurrenceSpecification || target instanceof MessageEnd)) {
- return false;
- }
- if (source instanceof Gate) {
- Message ownerMessage = ((Gate) source).getMessage();
- return ownerMessage == null ? true : ownerMessage == message;
- }
- if (target instanceof Gate) {
- return false;
- }
- return true;
- }
-
- public static boolean canExistLostMessage(Message message, Element source) {
- if (source instanceof Gate) {
- Message ownMessage = ((Gate) source).getMessage();
- if (ownMessage == null) {
- return true;
- }
- return ownMessage == message;
- }
- return true;
- }
-
- public static boolean canExistFoundMessage(Message message, Element target) {
- if (target instanceof Gate) {
- return message == null ? ((Gate) target).getMessage() == null : message == ((Gate) target).getMessage();
- }
- return true;
- }
-
- public static boolean canExistAsynchMessage(Message message, Element source, Element target) {
- if (target instanceof Message) {
- return false;
- }
- // Only available for ExecutionSpecification and Lifeline.
- if (target != null && !(target instanceof ExecutionSpecification || target instanceof Lifeline || target instanceof InteractionFragment || target instanceof MessageEnd)) {
- return false;
- }
- if (source instanceof Gate) {
- Message ownerMessage = ((Gate) source).getMessage();
- return ownerMessage == null ? true : ownerMessage == message;
- }
- if (target instanceof Gate) {
- Message ownerMessage = ((Gate) target).getMessage();
- return ownerMessage == null ? true : ownerMessage == message;
- }
- return true;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA + * + * + * 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: + * Soyatec - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; +import org.eclipse.uml2.uml.ExecutionSpecification; +import org.eclipse.uml2.uml.Gate; +import org.eclipse.uml2.uml.InteractionFragment; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.MessageEnd; +import org.eclipse.uml2.uml.MessageSort; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.OccurrenceSpecification; + +/** + * Helper class for determine the message connections. Both for connecting and reconnecting. + * + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class MessageConnectionHelper { + + public static boolean debug = false; + + private MessageConnectionHelper() { + } + + public static Element getMessageTarget(Message message) { + Element target = null; + MessageEnd receiveEvent = message.getReceiveEvent(); + if (receiveEvent instanceof OccurrenceSpecification) { + EList<Lifeline> covereds = ((OccurrenceSpecification) receiveEvent).getCovereds(); + if (!covereds.isEmpty()) { + target = covereds.get(0); + } + } else if (receiveEvent instanceof Gate + // special handling of SyncMessages due to #425666 + && MessageSort.SYNCH_CALL_LITERAL != message.getMessageSort()) { + target = ((Gate) receiveEvent).getOwner(); + } + return target; + } + + public static Element getMessageSource(Message message) { + Element source = null; + MessageEnd sendEvent = message.getSendEvent(); + if (sendEvent instanceof OccurrenceSpecification) { + EList<Lifeline> covereds = ((OccurrenceSpecification) sendEvent).getCovereds(); + if (!covereds.isEmpty()) { + source = covereds.get(0); + } + } else if (sendEvent instanceof Gate + // special handling of SyncMessages due to #425666 + && MessageSort.SYNCH_CALL_LITERAL != message.getMessageSort()) { + source = ((Gate) sendEvent).getOwner(); + } + return source; + } + + public static boolean canReorientSource(Message message, Element newSource) { + if (message == null || newSource == null) { + return false; + } + return canExist(message, newSource, getMessageTarget(message)); + } + + public static boolean canReorientTarget(Message message, Element newTarget) { + if (message == null || newTarget == null) { + return false; + } + return canExist(message, getMessageSource(message), newTarget); + } + + public static boolean canExist(Message message, Element source, Element target) { + MessageSort messageSort = null; + if (message != null) { + messageSort = message.getMessageSort(); + } + return canExist(message, messageSort, source, target); + } + + public static boolean canExist(Message message, MessageSort messageSort, Element source, Element target) { + if (debug) { + print(messageSort, source, target); + } + if (MessageSort.ASYNCH_CALL_LITERAL == messageSort) { + return canExistAsynchMessage(message, source, target); + } else if (MessageSort.ASYNCH_SIGNAL_LITERAL == messageSort) { + if (source == null) { + return canExistFoundMessage(message, target); + } + if (target == null) { + return canExistLostMessage(message, source); + } + } else if (MessageSort.SYNCH_CALL_LITERAL == messageSort) { + return canExistSynchMessage(message, source, target); + } else if (MessageSort.CREATE_MESSAGE_LITERAL == messageSort) { + return canExistCreateMessage(message, source, target); + } else if (MessageSort.DELETE_MESSAGE_LITERAL == messageSort) { + return canExistDeleteMessage(message, source, target); + } else if (MessageSort.REPLY_LITERAL == messageSort) { + return canExistReplyMessage(message, source, target); + } + return false; + } + + public static boolean canExist(MessageSort messageSort, Element source, Element target) { + return canExist(null, messageSort, source, target); + } + + private static void print(MessageSort messageSort, Element source, Element target) { + StringBuffer buf = new StringBuffer(); + if (messageSort != null) { + buf.append(messageSort.getName()); + buf.append("["); + } + buf.append("Source: "); + if (source != null) { + buf.append(source.eClass().getName()); + if (source instanceof NamedElement) { + buf.append("("); + buf.append(UMLLabelInternationalization.getInstance().getLabel(((NamedElement) source))); + buf.append(")"); + } + } else { + buf.append("null"); + } + buf.append(", Target: "); + if (target != null) { + buf.append(target.eClass().getName()); + if (target instanceof NamedElement) { + buf.append("("); + buf.append(UMLLabelInternationalization.getInstance().getLabel(((NamedElement) target))); + buf.append(")"); + } + } else { + buf.append("null"); + } + buf.append("]"); + System.out.println(new String(buf)); + } + + public static boolean canExistReplyMessage(Message message, Element source, Element target) { + if (target instanceof Message) { + return false; + } + if (source instanceof ExecutionSpecification && target instanceof Lifeline) { + if (((ExecutionSpecification) source).getCovereds().contains(target)) { + return false; + } + } + if (target instanceof Gate) { + Message ownMessage = ((Gate) target).getMessage(); + if (ownMessage == null) { + return true; + } + return ownMessage == message; + } + return true; + } + + public static boolean canExistDeleteMessage(Message message, Element source, Element target) { + return true; + } + + public static boolean canExistCreateMessage(Message message, Element source, Element target) { + if (target != null) { + if (false == target instanceof Lifeline) { + return false; + } + if (target == source) { + return false; + } + } + return true; + } + + public static boolean canExistSynchMessage(Message message, Element source, Element target) { + if (target instanceof Message) { + return false; + } + if (source != null && !(source instanceof ExecutionSpecification || source instanceof Lifeline || source instanceof ExecutionOccurrenceSpecification || source instanceof MessageEnd)) { + return false; + } + if (target != null && !(target instanceof ExecutionSpecification || target instanceof Lifeline || target instanceof ExecutionOccurrenceSpecification || target instanceof MessageEnd)) { + return false; + } + if (source instanceof Gate) { + Message ownerMessage = ((Gate) source).getMessage(); + return ownerMessage == null ? true : ownerMessage == message; + } + if (target instanceof Gate) { + return false; + } + return true; + } + + public static boolean canExistLostMessage(Message message, Element source) { + if (source instanceof Gate) { + Message ownMessage = ((Gate) source).getMessage(); + if (ownMessage == null) { + return true; + } + return ownMessage == message; + } + return true; + } + + public static boolean canExistFoundMessage(Message message, Element target) { + if (target instanceof Gate) { + return message == null ? ((Gate) target).getMessage() == null : message == ((Gate) target).getMessage(); + } + return true; + } + + public static boolean canExistAsynchMessage(Message message, Element source, Element target) { + if (target instanceof Message) { + return false; + } + // Only available for ExecutionSpecification and Lifeline. + if (target != null && !(target instanceof ExecutionSpecification || target instanceof Lifeline || target instanceof InteractionFragment || target instanceof MessageEnd)) { + return false; + } + if (source instanceof Gate) { + Message ownerMessage = ((Gate) source).getMessage(); + return ownerMessage == null ? true : ownerMessage == message; + } + if (target instanceof Gate) { + Message ownerMessage = ((Gate) target).getMessage(); + return ownerMessage == null ? true : ownerMessage == message; + } + return true; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationHelper.java index 8a03aae6d43..500e5109a5d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationHelper.java @@ -1,160 +1,169 @@ -/*****************************************************************************
- * Copyright (c) 2013, 2014 Soyatec, CEA, and others
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- * Christian W. Damus (CEA) - bug 426732
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.ExecutionSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Update execution ends to message ends for Sync and Reply message, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=402975
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class OccurrenceSpecificationHelper {
-
- /**
- * Constructor.
- *
- */
- private OccurrenceSpecificationHelper() {
- }
-
- public static boolean resetExecutionStart(ExecutionSpecification execution, Element newStart) {
- if (!(newStart instanceof OccurrenceSpecification)) {
- return false;
- }
- return resetExecutionEnd(execution, (OccurrenceSpecification) newStart, true);
- }
-
- public static boolean resetExecutionFinish(ExecutionSpecification execution, Element newFinish) {
- if (!(newFinish instanceof OccurrenceSpecification)) {
- return false;
- }
- return resetExecutionEnd(execution, (OccurrenceSpecification) newFinish, false);
- }
-
- private static void copyInfo(OccurrenceSpecification fromOS, OccurrenceSpecification toOS) {
- if (fromOS == null || toOS == null) {
- return;
- }
- EList<Lifeline> covereds = fromOS.getCovereds();
- for (Lifeline lifeline : covereds) {
- if (toOS.getCovereds().contains(lifeline)) {
- continue;
- }
- toOS.getCovereds().add(lifeline);
- }
- }
-
- public static boolean resetExecutionEnd(ExecutionSpecification execution, OccurrenceSpecification newEnd, boolean isStart) {
- if (execution == null || newEnd == null) {
- return false;
- }
- OccurrenceSpecification oldEnd = isStart ? execution.getStart() : execution.getFinish();
- if (newEnd.eContainer() == null) {
- EObject eContainer = oldEnd != null ? oldEnd.eContainer() : execution.eContainer();
- if (eContainer instanceof Interaction) {
- newEnd.setEnclosingInteraction((Interaction) eContainer);
- } else if (eContainer instanceof InteractionOperand) {
- newEnd.setEnclosingOperand((InteractionOperand) eContainer);
- }
- }
- if (newEnd.getName() == null) {
- if (isStart) {
- newEnd.setName(execution.getName() + "Start");
- } else {
- newEnd.setName(execution.getName() + "Finish");
- }
- }
- copyInfo(oldEnd, newEnd);
- if (newEnd instanceof ExecutionOccurrenceSpecification) {
- ((ExecutionOccurrenceSpecification) newEnd).setExecution(execution);
- }
- if (isStart) {
- execution.setStart(newEnd);
- } else {
- execution.setFinish(newEnd);
- }
- if (canBeRemoved(oldEnd, newEnd, isStart)) {
- // "coveredBy" is bidirectional so must be cleaned prior to deletion of element itself
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=451320
- oldEnd.getCovereds().clear();
-
- EcoreUtil.remove(oldEnd);
- }
- return true;
- }
-
- /**
- * The given <code>Occurrence Specification</code> object can be removed without any references.
- *
- * @param isStart
- */
- private static boolean canBeRemoved(OccurrenceSpecification os, OccurrenceSpecification copy, boolean isStart) {
- if (os == null || copy == null || os instanceof MessageOccurrenceSpecification) {
- return false;
- }
- Collection<Setting> usages = EMFHelper.getUsages(os);
- for (Setting setting : usages) {
- Object osValue = setting.get(true);
- if (osValue instanceof List<?> && ((List<?>) osValue).contains(copy)) {
- continue;
- }
- EStructuralFeature feature = setting.getEStructuralFeature();
- if (isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Start() == feature) {
- continue;
- } else if (!isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Finish() == feature) {
- continue;
- }
- }
- return true;
- }
-
- /**
- * Find an Execution with the given end.
- */
- public static ExecutionSpecification findExecutionWith(OccurrenceSpecification end, boolean isStart) {
- if (end instanceof ExecutionOccurrenceSpecification) {
- return ((ExecutionOccurrenceSpecification) end).getExecution();
- }
- Collection<Setting> usages = EMFHelper.getUsages(end);
- for (Setting setting : usages) {
- EObject eObject = setting.getEObject();
- EStructuralFeature feature = setting.getEStructuralFeature();
- if (isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Start() == feature) {
- return (ExecutionSpecification) eObject;
- } else if (!isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Finish() == feature) {
- return (ExecutionSpecification) eObject;
- }
- }
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013, 2014 Soyatec, CEA, and others + * + * + * 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: + * Soyatec - Initial API and implementation + * Christian W. Damus (CEA) - bug 426732 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EStructuralFeature.Setting; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; +import org.eclipse.uml2.uml.ExecutionSpecification; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.MessageOccurrenceSpecification; +import org.eclipse.uml2.uml.OccurrenceSpecification; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Update execution ends to message ends for Sync and Reply message, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=402975 + * + * @author Jin Liu (jin.liu@soyatec.com) + */ +public class OccurrenceSpecificationHelper { + + /** + * Constructor. + * + */ + private OccurrenceSpecificationHelper() { + } + + public static boolean resetExecutionStart(ExecutionSpecification execution, Element newStart) { + if (!(newStart instanceof OccurrenceSpecification)) { + return false; + } + return resetExecutionEnd(execution, (OccurrenceSpecification) newStart, true); + } + + public static boolean resetExecutionFinish(ExecutionSpecification execution, Element newFinish) { + if (!(newFinish instanceof OccurrenceSpecification)) { + return false; + } + return resetExecutionEnd(execution, (OccurrenceSpecification) newFinish, false); + } + + private static void copyInfo(OccurrenceSpecification fromOS, OccurrenceSpecification toOS) { + if (fromOS == null || toOS == null) { + return; + } + EList<Lifeline> covereds = fromOS.getCovereds(); + for (Lifeline lifeline : covereds) { + if (toOS.getCovereds().contains(lifeline)) { + continue; + } + toOS.getCovereds().add(lifeline); + } + } + + public static boolean resetExecutionEnd(ExecutionSpecification execution, OccurrenceSpecification newEnd, boolean isStart) { + if (execution == null || newEnd == null) { + return false; + } + OccurrenceSpecification oldEnd = isStart ? execution.getStart() : execution.getFinish(); + if (newEnd.eContainer() == null) { + EObject eContainer = oldEnd != null ? oldEnd.eContainer() : execution.eContainer(); + if (eContainer instanceof Interaction) { + newEnd.setEnclosingInteraction((Interaction) eContainer); + } else if (eContainer instanceof InteractionOperand) { + newEnd.setEnclosingOperand((InteractionOperand) eContainer); + } + } + copyInfo(oldEnd, newEnd); + if (newEnd instanceof ExecutionOccurrenceSpecification) { + ((ExecutionOccurrenceSpecification) newEnd).setExecution(execution); + } + if (isStart) { + execution.setStart(newEnd); + } else { + execution.setFinish(newEnd); + } + if (newEnd.getName() == null) { + if (isStart) { + newEnd.setName(execution.getName() + "Start"); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(execution) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution)){ + UMLLabelInternationalization.getInstance().setLabel(newEnd, UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution) + "Start", null); + } + } else { + newEnd.setName(execution.getName() + "Finish"); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(execution) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution)){ + UMLLabelInternationalization.getInstance().setLabel(newEnd, UMLLabelInternationalization.getInstance().getLabelWithoutUML(execution) + "Finish", null); + } + } + } + if (canBeRemoved(oldEnd, newEnd, isStart)) { + // "coveredBy" is bidirectional so must be cleaned prior to deletion of element itself + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=451320 + oldEnd.getCovereds().clear(); + + EcoreUtil.remove(oldEnd); + } + return true; + } + + /** + * The given <code>Occurrence Specification</code> object can be removed without any references. + * + * @param isStart + */ + private static boolean canBeRemoved(OccurrenceSpecification os, OccurrenceSpecification copy, boolean isStart) { + if (os == null || copy == null || os instanceof MessageOccurrenceSpecification) { + return false; + } + Collection<Setting> usages = EMFHelper.getUsages(os); + for (Setting setting : usages) { + Object osValue = setting.get(true); + if (osValue instanceof List<?> && ((List<?>) osValue).contains(copy)) { + continue; + } + EStructuralFeature feature = setting.getEStructuralFeature(); + if (isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Start() == feature) { + continue; + } else if (!isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Finish() == feature) { + continue; + } + } + return true; + } + + /** + * Find an Execution with the given end. + */ + public static ExecutionSpecification findExecutionWith(OccurrenceSpecification end, boolean isStart) { + if (end instanceof ExecutionOccurrenceSpecification) { + return ((ExecutionOccurrenceSpecification) end).getExecution(); + } + Collection<Setting> usages = EMFHelper.getUsages(end); + for (Setting setting : usages) { + EObject eObject = setting.getEObject(); + EStructuralFeature feature = setting.getEStructuralFeature(); + if (isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Start() == feature) { + return (ExecutionSpecification) eObject; + } else if (!isStart && UMLPackage.eINSTANCE.getExecutionSpecification_Finish() == feature) { + return (ExecutionSpecification) eObject; + } + } + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperationUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperationUtil.java index 8bdbe346175..15afcc8f7d8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperationUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperationUtil.java @@ -1,272 +1,286 @@ -package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.papyrus.infra.tools.util.StringHelper;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.ParameterUtil;
-import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
-import org.eclipse.papyrus.uml.tools.utils.TypedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-public class OperationUtil {
-
- public static String getCustomLabel(Message e, int paramIndex, Parameter parameter, Collection<String> displayValue) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
- }
- // direction property
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) {
- buffer.append(" ");
- buffer.append(parameter.getDirection().getLiteral());
- }
- boolean showEqualMark = false;
- // name
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) {
- buffer.append(" ");
- String name = StringHelper.trimToEmpty(parameter.getName());
- if (name.trim().length() > 0) {
- showEqualMark = true;
- }
- buffer.append(name);
- }
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
- // type
- if (parameter.getType() != null) {
- buffer.append(": " + StringHelper.trimToEmpty(parameter.getType().getName()));
- } else {
- buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
- showEqualMark = true;
- }
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY)) {
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
- buffer.append(multiplicity);
- }
- if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) {
- String value = getValue(e, paramIndex, parameter);
- if (value != null) {
- if (showEqualMark) {
- buffer.append(" = ");
- }
- buffer.append(value);
- }
- } else if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT)) {
- // default value
- if (parameter.getDefault() != null) {
- if (showEqualMark) {
- buffer.append(" = ");
- }
- buffer.append(parameter.getDefault());
- }
- }
- if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
- boolean multiLine = displayValue.contains(ICustomAppearance.DISP_MULTI_LINE);
- // property modifiers
- String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine);
- if (!modifiers.equals("")) {
- if (multiLine) {
- buffer.append("\n");
- }
- buffer.append(modifiers);
- }
- }
- return buffer.toString();
- }
-
- private static String getValue(Message e, int paramIndex, Parameter parameter) {
- try {
- EList<ValueSpecification> arguments = e.getArguments();
- if (arguments.size() > paramIndex) {
- return ValueSpecificationUtil.getSpecificationValue(arguments.get(paramIndex));
- }
- } catch (Exception e1) {
- }
- return null;
- }
-
- public static String getCustomLabel(Message message, Operation operation, Collection<String> displayValue) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(" "); // adds " " first for correct display considerations
- // visibility
- if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(operation));
- }
- // name
- if (displayValue.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(StringHelper.trimToEmpty(operation.getName()));
- }
- //
- // parameters : '(' parameter-list ')'
- buffer.append("(");
- buffer.append(getParametersAsString(message, operation, displayValue));
- buffer.append(")");
- // return type
- if (displayValue.contains(ICustomAppearance.DISP_RT_TYPE) || displayValue.contains(ICustomAppearance.DISP_TYPE)) {
- buffer.append(getReturnTypeAsString(operation, displayValue));
- }
- // modifiers
- if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
- String modifiers = getModifiersAsString(operation);
- if (!modifiers.equals("")) {
- buffer.append("{");
- buffer.append(modifiers);
- buffer.append("}");
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns operation modifiers as string, separated with comma.
- *
- * @return a string containing the modifiers
- */
- private static String getModifiersAsString(Operation operation) {
- StringBuffer buffer = new StringBuffer();
- boolean needsComma = false;
- // Return parameter modifiers
- Parameter returnParameter = OperationUtil.getReturnParameter(operation);
- if (returnParameter != null) {
- // non unique parameter
- if (!returnParameter.isUnique()) {
- buffer.append("nonunique");
- needsComma = true;
- }
- // return parameter has ordered values
- if (returnParameter.isOrdered()) {
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("ordered");
- needsComma = true;
- }
- }
- // is the operation a query ?
- if (operation.isQuery()) {
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("query");
- needsComma = true;
- }
- // is the operation redefining another operation ?
- Iterator<Operation> it = operation.getRedefinedOperations().iterator();
- while (it.hasNext()) {
- Operation currentOperation = it.next();
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("redefines ");
- buffer.append(currentOperation.getName());
- needsComma = true;
- }
- // has the operation a constraint ?
- Iterator<Constraint> it2 = operation.getOwnedRules().iterator();
- while (it2.hasNext()) {
- Constraint constraint = it2.next();
- if (needsComma) {
- buffer.append(", ");
- }
- if (constraint.getSpecification() != null) {
- buffer.append(constraint.getSpecification().stringValue());
- }
- needsComma = true;
- }
- return buffer.toString();
- }
-
- /**
- * Returns return parameter label as a string, string parametrized with a style mask.
- *
- * @param style
- * the mask that indicates which element to display
- * @return a string containing the return parameter type
- */
- private static String getReturnTypeAsString(Operation operation, Collection<String> displayValue) {
- boolean displayType = displayValue.contains(ICustomAppearance.DISP_RT_TYPE) || displayValue.contains(ICustomAppearance.DISP_TYPE);
- boolean displayMultiplicity = displayValue.contains(ICustomAppearance.DISP_RT_MULTIPLICITY) || displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY);
- StringBuffer label = new StringBuffer("");
- // Retrieve the return parameter (assume to be unique if defined)
- Parameter returnParameter = getReturnParameter(operation);
- // Create the string for the return type
- if (returnParameter == null) {
- // no-operation: label = ""
- } else if (!displayType && !displayMultiplicity) {
- // no-operation: label = ""
- } else {
- label.append(": ");
- if (displayType) {
- label.append(TypedElementUtil.getTypeAsString(returnParameter));
- }
- if (displayMultiplicity) {
- label.append(MultiplicityElementUtil.getMultiplicityAsString(returnParameter));
- }
- }
- return label.toString();
- }
-
- /**
- * Gives the return parameter for this operation, or <code>null</code> if none exists.
- *
- * @return the return parameter of the operation or <code>null</code>
- */
- private static Parameter getReturnParameter(Operation operation) {
- // Retrieve the return parameter (assume to be unique if defined)
- Parameter returnParameter = null;
- Iterator<Parameter> it = operation.getOwnedParameters().iterator();
- while ((returnParameter == null) && (it.hasNext())) {
- Parameter parameter = it.next();
- if (parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
- returnParameter = parameter;
- }
- }
- return returnParameter;
- }
-
- /**
- * Returns operation parameters as a string, the label is customized using a bit mask
- *
- * @param e
- *
- * @return a string containing all parameters separated by commas
- */
- private static String getParametersAsString(Message e, Operation operation, Collection<String> displayValue) {
- StringBuffer paramString = new StringBuffer();
- Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator();
- boolean firstParameter = true;
- int paramIndex = 0;
- while (paramIterator.hasNext()) {
- Parameter parameter = paramIterator.next();
- // Do not include return parameters
- if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
- // get the label for this parameter
- String parameterString = getCustomLabel(e, paramIndex, parameter, displayValue).trim();
- paramIndex++;
- if (!parameterString.equals("")) {
- if (!firstParameter) {
- paramString.append(", ");
- }
- paramString.append(parameterString);
- firstParameter = false;
- }
- }
- }
- return paramString.toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import java.util.Collection; +import java.util.Iterator; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.infra.tools.util.StringHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.ParameterUtil; +import org.eclipse.papyrus.uml.tools.utils.TypeUtil; +import org.eclipse.papyrus.uml.tools.utils.TypedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.ValueSpecification; + +public class OperationUtil { + + public static String getCustomLabel(Message e, int paramIndex, Parameter parameter, Collection<String> displayValue) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(parameter)); + } + // direction property + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) { + buffer.append(" "); + buffer.append(parameter.getDirection().getLiteral()); + } + boolean showEqualMark = false; + // name + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) { + buffer.append(" "); + String name = StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(parameter)); + if (name.trim().length() > 0) { + showEqualMark = true; + } + buffer.append(name); + } + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { + // type + if (parameter.getType() != null) { + buffer.append(": " + StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(parameter.getType()))); + } else { + buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); + } + showEqualMark = true; + } + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY)) { + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter); + buffer.append(multiplicity); + } + if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) { + String value = getValue(e, paramIndex, parameter); + if (value != null) { + if (showEqualMark) { + buffer.append(" = "); + } + buffer.append(value); + } + } else if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT)) { + // default value + if (parameter.getDefault() != null) { + if (showEqualMark) { + buffer.append(" = "); + } + buffer.append(parameter.getDefault()); + } + } + if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { + boolean multiLine = displayValue.contains(ICustomAppearance.DISP_MULTI_LINE); + // property modifiers + String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine); + if (!modifiers.equals("")) { + if (multiLine) { + buffer.append("\n"); + } + buffer.append(modifiers); + } + } + return buffer.toString(); + } + + private static String getValue(Message e, int paramIndex, Parameter parameter) { + try { + EList<ValueSpecification> arguments = e.getArguments(); + if (arguments.size() > paramIndex) { + return ValueSpecificationUtil.getSpecificationValue(arguments.get(paramIndex), true); + } + } catch (Exception e1) { + } + return null; + } + + public static String getCustomLabel(Message message, Operation operation, Collection<String> displayValue) { + StringBuffer buffer = new StringBuffer(); + buffer.append(" "); // adds " " first for correct display considerations + // visibility + if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(operation)); + } + // name + if (displayValue.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(operation))); + } + // + // parameters : '(' parameter-list ')' + buffer.append("("); + buffer.append(getParametersAsString(message, operation, displayValue)); + buffer.append(")"); + // return type + if (displayValue.contains(ICustomAppearance.DISP_RT_TYPE) || displayValue.contains(ICustomAppearance.DISP_TYPE)) { + buffer.append(getReturnTypeAsString(operation, displayValue)); + } + // modifiers + if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { + String modifiers = getModifiersAsString(operation); + if (!modifiers.equals("")) { + buffer.append("{"); + buffer.append(modifiers); + buffer.append("}"); + } + } + return buffer.toString(); + } + + /** + * Returns operation modifiers as string, separated with comma. + * + * @return a string containing the modifiers + */ + private static String getModifiersAsString(Operation operation) { + StringBuffer buffer = new StringBuffer(); + boolean needsComma = false; + // Return parameter modifiers + Parameter returnParameter = OperationUtil.getReturnParameter(operation); + if (returnParameter != null) { + // non unique parameter + if (!returnParameter.isUnique()) { + buffer.append("nonunique"); + needsComma = true; + } + // return parameter has ordered values + if (returnParameter.isOrdered()) { + if (needsComma) { + buffer.append(", "); + } + buffer.append("ordered"); + needsComma = true; + } + } + // is the operation a query ? + if (operation.isQuery()) { + if (needsComma) { + buffer.append(", "); + } + buffer.append("query"); + needsComma = true; + } + // is the operation redefining another operation ? + Iterator<Operation> it = operation.getRedefinedOperations().iterator(); + while (it.hasNext()) { + Operation currentOperation = it.next(); + if (needsComma) { + buffer.append(", "); + } + buffer.append("redefines "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(currentOperation)); + needsComma = true; + } + // has the operation a constraint ? + Iterator<Constraint> it2 = operation.getOwnedRules().iterator(); + while (it2.hasNext()) { + Constraint constraint = it2.next(); + if (needsComma) { + buffer.append(", "); + } + if (constraint.getSpecification() != null) { + buffer.append(constraint.getSpecification().stringValue()); + } + needsComma = true; + } + return buffer.toString(); + } + + /** + * Returns return parameter label as a string, string parametrized with a style mask. + * + * @param style + * the mask that indicates which element to display + * @return a string containing the return parameter type + */ + private static String getReturnTypeAsString(Operation operation, Collection<String> displayValue) { + boolean displayType = displayValue.contains(ICustomAppearance.DISP_RT_TYPE) || displayValue.contains(ICustomAppearance.DISP_TYPE); + boolean displayMultiplicity = displayValue.contains(ICustomAppearance.DISP_RT_MULTIPLICITY) || displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY); + StringBuffer label = new StringBuffer(""); + // Retrieve the return parameter (assume to be unique if defined) + Parameter returnParameter = getReturnParameter(operation); + // Create the string for the return type + if (returnParameter == null) { + // no-operation: label = "" + } else if (!displayType && !displayMultiplicity) { + // no-operation: label = "" + } else { + label.append(": "); + if (displayType) { + label.append(TypedElementUtil.getTypeAsString(returnParameter)); + } + if (displayMultiplicity) { + label.append(MultiplicityElementUtil.getMultiplicityAsString(returnParameter)); + } + } + return label.toString(); + } + + /** + * Gives the return parameter for this operation, or <code>null</code> if none exists. + * + * @return the return parameter of the operation or <code>null</code> + */ + private static Parameter getReturnParameter(Operation operation) { + // Retrieve the return parameter (assume to be unique if defined) + Parameter returnParameter = null; + Iterator<Parameter> it = operation.getOwnedParameters().iterator(); + while ((returnParameter == null) && (it.hasNext())) { + Parameter parameter = it.next(); + if (parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) { + returnParameter = parameter; + } + } + return returnParameter; + } + + /** + * Returns operation parameters as a string, the label is customized using a bit mask + * + * @param e + * + * @return a string containing all parameters separated by commas + */ + private static String getParametersAsString(Message e, Operation operation, Collection<String> displayValue) { + StringBuffer paramString = new StringBuffer(); + Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator(); + boolean firstParameter = true; + int paramIndex = 0; + while (paramIterator.hasNext()) { + Parameter parameter = paramIterator.next(); + // Do not include return parameters + if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) { + // get the label for this parameter + String parameterString = getCustomLabel(e, paramIndex, parameter, displayValue).trim(); + paramIndex++; + if (!parameterString.equals("")) { + if (!firstParameter) { + paramString.append(", "); + } + paramString.append(parameterString); + firstParameter = false; + } + } + } + return paramString.toString(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SignalUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SignalUtil.java index 63ab69a46b4..ed215584545 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SignalUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SignalUtil.java @@ -1,155 +1,169 @@ -package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.papyrus.infra.tools.util.StringHelper;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance;
-import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
-import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-public class SignalUtil {
-
- private static String getCustomPropertyLabel(Message e, Property property, Collection<String> displayValue) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(property));
- }
- // derived property
- if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) {
- if (property.isDerived()) {
- buffer.append("/");
- }
- }
- boolean showEqualMark = false;
- // name
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) {
- buffer.append(" ");
- String name = StringHelper.trimToEmpty(property.getName());
- if (name.trim().length() > 0) {
- showEqualMark = true;
- }
- buffer.append(name);
- }
- if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
- // type
- if (property.getType() != null) {
- buffer.append(": " + StringHelper.trimToEmpty(property.getType().getName()));
- } else {
- buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
- showEqualMark = true;
- }
- if (displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY)) {
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
- buffer.append(multiplicity);
- }
- if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) {
- String value = getValue(e, property);
- if (value != null) {
- if (showEqualMark) {
- buffer.append(" = ");
- }
- buffer.append(value);
- }
- } else if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT)) {
- // default value
- if (property.getDefaultValue() != null) {
- if (showEqualMark) {
- buffer.append(" = ");
- }
- buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue()));
- }
- }
- if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
- boolean multiLine = displayValue.contains(ICustomAppearance.DISP_MULTI_LINE);
- // property modifiers
- String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
- if (!modifiers.equals("")) {
- if (multiLine) {
- buffer.append("\n");
- }
- if (!buffer.toString().endsWith(" ")) {
- buffer.append(" ");
- }
- buffer.append(modifiers);
- }
- }
- return buffer.toString();
- }
-
- private static String getValue(Message e, Property property) {
- try {
- Signal signal = (Signal) property.getOwner();
- int index = signal.getOwnedAttributes().indexOf(property);
- EList<ValueSpecification> arguments = e.getArguments();
- if (arguments.size() > index) {
- return ValueSpecificationUtil.getSpecificationValue(arguments.get(index));
- }
- } catch (Exception e1) {
- }
- return null;
- }
-
- /**
- * return the custom label of the signal, given UML2 specification and a custom style.
- *
- * @param message
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the signal
- */
- public static String getCustomLabel(Message message, Signal signal, Collection<String> displayValue) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(" "); // adds " " first for correct display considerations
- // visibility
- if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(signal));
- }
- // name
- if (displayValue.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(StringHelper.trimToEmpty(signal.getName()));
- }
- //
- // parameters : '(' parameter-list ')'
- buffer.append("(");
- buffer.append(getPropertiesAsString(message, signal, displayValue));
- buffer.append(")");
- return buffer.toString();
- }
-
- /**
- * Returns signal properties as a string, the label is customized using a bit mask
- *
- * @return a string containing all properties separated by commas
- */
- private static String getPropertiesAsString(Message e, Signal signal, Collection<String> displayValue) {
- StringBuffer propertiesString = new StringBuffer();
- boolean firstProperty = true;
- for (Property property : signal.getOwnedAttributes()) {
- // get the label for this property
- String propertyString = getCustomPropertyLabel(e, property, displayValue).trim();
- if (!propertyString.equals("")) {
- if (!firstProperty) {
- propertiesString.append(", ");
- }
- propertiesString.append(propertyString);
- firstProperty = false;
- }
- }
- return propertiesString.toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.util; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.infra.tools.util.StringHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; +import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.PropertyUtil; +import org.eclipse.papyrus.uml.tools.utils.TypeUtil; +import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Signal; +import org.eclipse.uml2.uml.ValueSpecification; + +public class SignalUtil { + + private static String getCustomPropertyLabel(Message e, Property property, Collection<String> displayValue) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(property)); + } + // derived property + if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) { + if (property.isDerived()) { + buffer.append("/"); + } + } + boolean showEqualMark = false; + // name + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) { + buffer.append(" "); + String name = StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(property)); + if (name.trim().length() > 0) { + showEqualMark = true; + } + buffer.append(name); + } + if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { + // type + if (property.getType() != null) { + buffer.append(": " + StringHelper.trimToEmpty(property.getType().getName())); + } else { + buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); + } + showEqualMark = true; + } + if (displayValue.contains(ICustomAppearance.DISP_MULTIPLICITY)) { + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property); + buffer.append(multiplicity); + } + if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) { + String value = getValue(e, property); + if (value != null) { + if (showEqualMark) { + buffer.append(" = "); + } + buffer.append(value); + } + } else if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT)) { + // default value + if (property.getDefaultValue() != null) { + if (showEqualMark) { + buffer.append(" = "); + } + buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue(), true)); + } + } + if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { + boolean multiLine = displayValue.contains(ICustomAppearance.DISP_MULTI_LINE); + // property modifiers + String modifiers = PropertyUtil.getModifiersAsString(property, multiLine); + if (!modifiers.equals("")) { + if (multiLine) { + buffer.append("\n"); + } + if (!buffer.toString().endsWith(" ")) { + buffer.append(" "); + } + buffer.append(modifiers); + } + } + return buffer.toString(); + } + + private static String getValue(Message e, Property property) { + try { + Signal signal = (Signal) property.getOwner(); + int index = signal.getOwnedAttributes().indexOf(property); + EList<ValueSpecification> arguments = e.getArguments(); + if (arguments.size() > index) { + return ValueSpecificationUtil.getSpecificationValue(arguments.get(index), true); + } + } catch (Exception e1) { + } + return null; + } + + /** + * return the custom label of the signal, given UML2 specification and a custom style. + * + * @param message + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the signal + */ + public static String getCustomLabel(Message message, Signal signal, Collection<String> displayValue) { + StringBuffer buffer = new StringBuffer(); + buffer.append(" "); // adds " " first for correct display considerations + // visibility + if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(signal)); + } + // name + if (displayValue.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(StringHelper.trimToEmpty(UMLLabelInternationalization.getInstance().getLabel(signal))); + } + // + // parameters : '(' parameter-list ')' + buffer.append("("); + buffer.append(getPropertiesAsString(message, signal, displayValue)); + buffer.append(")"); + return buffer.toString(); + } + + /** + * Returns signal properties as a string, the label is customized using a bit mask + * + * @return a string containing all properties separated by commas + */ + private static String getPropertiesAsString(Message e, Signal signal, Collection<String> displayValue) { + StringBuffer propertiesString = new StringBuffer(); + boolean firstProperty = true; + for (Property property : signal.getOwnedAttributes()) { + // get the label for this property + String propertyString = getCustomPropertyLabel(e, property, displayValue).trim(); + if (!propertyString.equals("")) { + if (!firstProperty) { + propertiesString.append(", "); + } + propertiesString.append(propertyString); + firstProperty = false; + } + } + return propertiesString.toString(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLabelProvider.java index f473998152e..5eaf5118caa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLabelProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLabelProvider.java @@ -1,852 +1,854 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.navigator;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.ITreePathLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.ViewerLabel;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConsiderIgnoreFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageAsyncEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageAsyncNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageCreateEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageCreateNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageDeleteEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageDeleteNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageReplyEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageReplyNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageSyncEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageSyncNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantNameEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLParserProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonLabelProvider;
-import org.eclipse.uml2.uml.ActionExecutionSpecification;
-import org.eclipse.uml2.uml.BehaviorExecutionSpecification;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * @generated
- */
-public class UMLNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {
-
- /**
- * @generated
- */
- static {
- UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", //$NON-NLS-1$
- ImageDescriptor.getMissingImageDescriptor());
- UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", //$NON-NLS-1$
- ImageDescriptor.getMissingImageDescriptor());
- }
-
- /**
- * @generated
- */
- @Override
- public void updateLabel(ViewerLabel label, TreePath elementPath) {
- Object element = elementPath.getLastSegment();
- if (element instanceof UMLNavigatorItem && !isOwnView(((UMLNavigatorItem) element).getView())) {
- return;
- }
- label.setText(getText(element));
- label.setImage(getImage(element));
- }
-
- /**
- * @generated
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup) element;
- return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
- }
-
- if (element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
- if (!isOwnView(navigatorItem.getView())) {
- return super.getImage(element);
- }
- return getImage(navigatorItem.getView());
- }
-
- return super.getImage(element);
- }
-
- /**
- * @generated
- */
- public Image getImage(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case PackageEditPart.VISUAL_ID:
- return getImage("Navigator?Diagram?http://www.eclipse.org/uml2/5.0.0/UML?Package", //$NON-NLS-1$
- UMLElementTypes.Package_SequenceDiagram);
- case InteractionEditPart.VISUAL_ID:
- return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/5.0.0/UML?Interaction", //$NON-NLS-1$
- UMLElementTypes.Interaction_Shape);
- case LifelineEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Lifeline", //$NON-NLS-1$
- UMLElementTypes.Lifeline_Shape);
- case InteractionUseEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?InteractionUse", //$NON-NLS-1$
- UMLElementTypes.InteractionUse_Shape);
- case BehaviorExecutionSpecificationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?BehaviorExecutionSpecification", //$NON-NLS-1$
- UMLElementTypes.BehaviorExecutionSpecification_Shape);
- case CombinedFragmentEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?CombinedFragment", //$NON-NLS-1$
- UMLElementTypes.CombinedFragment_Shape);
- case InteractionOperandEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?InteractionOperand", //$NON-NLS-1$
- UMLElementTypes.InteractionOperand_Shape);
- case ActionExecutionSpecificationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?ActionExecutionSpecification", //$NON-NLS-1$
- UMLElementTypes.ActionExecutionSpecification_Shape);
- case ConsiderIgnoreFragmentEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?ConsiderIgnoreFragment", //$NON-NLS-1$
- UMLElementTypes.ConsiderIgnoreFragment_Shape);
- case ConstraintEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Constraint", //$NON-NLS-1$
- UMLElementTypes.Constraint_Shape);
- case CommentEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Comment", //$NON-NLS-1$
- UMLElementTypes.Comment_Shape);
- case ContinuationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Continuation", //$NON-NLS-1$
- UMLElementTypes.Continuation_Shape);
- case StateInvariantEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?StateInvariant", //$NON-NLS-1$
- UMLElementTypes.StateInvariant_Shape);
- case CombinedFragment2EditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?CombinedFragment", //$NON-NLS-1$
- UMLElementTypes.CombinedFragment_CoRegionShape);
- case TimeConstraintEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?TimeConstraint", //$NON-NLS-1$
- UMLElementTypes.TimeConstraint_Shape);
- case TimeObservationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?TimeObservation", //$NON-NLS-1$
- UMLElementTypes.TimeObservation_Shape);
- case DurationConstraintEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationConstraint", //$NON-NLS-1$
- UMLElementTypes.DurationConstraint_Shape);
- case DestructionOccurrenceSpecificationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DestructionOccurrenceSpecification", //$NON-NLS-1$
- UMLElementTypes.DestructionOccurrenceSpecification_Shape);
- case DurationConstraintInMessageEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationConstraint", //$NON-NLS-1$
- UMLElementTypes.DurationConstraint_Shape_CN);
- case DurationObservationEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationObservation", //$NON-NLS-1$
- UMLElementTypes.DurationObservation_Shape);
- case MessageSyncEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_SynchEdge);
- case MessageAsyncEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_AsynchEdge);
- case MessageReplyEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_ReplyEdge);
- case MessageCreateEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_CreateEdge);
- case MessageDeleteEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_DeleteEdge);
- case MessageLostEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_LostEdge);
- case MessageFoundEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$
- UMLElementTypes.Message_FoundEdge);
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Comment?annotatedElement", //$NON-NLS-1$
- UMLElementTypes.Comment_AnnotatedElementEdge);
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Constraint?constrainedElement", //$NON-NLS-1$
- UMLElementTypes.Constraint_ConstrainedElementEdge);
- case GeneralOrderingEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?GeneralOrdering", //$NON-NLS-1$
- UMLElementTypes.GeneralOrdering_Edge);
- }
- return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Image getImage(String key, IElementType elementType) {
- ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) {
- image = UMLElementTypes.getImage(elementType);
- imageRegistry.put(key, image);
- }
-
- if (image == null) {
- image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
- imageRegistry.put(key, image);
- }
- return image;
- }
-
- /**
- * @generated
- */
- @Override
- public String getText(Object element) {
- if (element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup) element;
- return group.getGroupName();
- }
-
- if (element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
- if (!isOwnView(navigatorItem.getView())) {
- return null;
- }
- return getText(navigatorItem.getView());
- }
-
- return super.getText(element);
- }
-
- /**
- * @generated
- */
- public String getText(View view) {
- if (view.getElement() != null && view.getElement().eIsProxy()) {
- return getUnresolvedDomainElementProxyText(view);
- }
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case PackageEditPart.VISUAL_ID:
- return getPackage_SequenceDiagramText(view);
- case InteractionEditPart.VISUAL_ID:
- return getInteraction_ShapeText(view);
- case LifelineEditPart.VISUAL_ID:
- return getLifeline_ShapeText(view);
- case InteractionUseEditPart.VISUAL_ID:
- return getInteractionUse_ShapeText(view);
- case BehaviorExecutionSpecificationEditPart.VISUAL_ID:
- return getBehaviorExecutionSpecification_ShapeText(view);
- case CombinedFragmentEditPart.VISUAL_ID:
- return getCombinedFragment_ShapeText(view);
- case InteractionOperandEditPart.VISUAL_ID:
- return getInteractionOperand_ShapeText(view);
- case ActionExecutionSpecificationEditPart.VISUAL_ID:
- return getActionExecutionSpecification_ShapeText(view);
- case ConsiderIgnoreFragmentEditPart.VISUAL_ID:
- return getConsiderIgnoreFragment_ShapeText(view);
- case ConstraintEditPart.VISUAL_ID:
- return getConstraint_ShapeText(view);
- case CommentEditPart.VISUAL_ID:
- return getComment_ShapeText(view);
- case ContinuationEditPart.VISUAL_ID:
- return getContinuation_ShapeText(view);
- case StateInvariantEditPart.VISUAL_ID:
- return getStateInvariant_ShapeText(view);
- case CombinedFragment2EditPart.VISUAL_ID:
- return getCombinedFragment_CoRegionShapeText(view);
- case TimeConstraintEditPart.VISUAL_ID:
- return getTimeConstraint_ShapeText(view);
- case TimeObservationEditPart.VISUAL_ID:
- return getTimeObservation_ShapeText(view);
- case DurationConstraintEditPart.VISUAL_ID:
- return getDurationConstraint_ShapeText(view);
- case DestructionOccurrenceSpecificationEditPart.VISUAL_ID:
- return getDestructionOccurrenceSpecification_ShapeText(view);
- case DurationConstraintInMessageEditPart.VISUAL_ID:
- return getDurationConstraint_Shape_CNText(view);
- case DurationObservationEditPart.VISUAL_ID:
- return getDurationObservation_ShapeText(view);
- case MessageSyncEditPart.VISUAL_ID:
- return getMessage_SynchEdgeText(view);
- case MessageAsyncEditPart.VISUAL_ID:
- return getMessage_AsynchEdgeText(view);
- case MessageReplyEditPart.VISUAL_ID:
- return getMessage_ReplyEdgeText(view);
- case MessageCreateEditPart.VISUAL_ID:
- return getMessage_CreateEdgeText(view);
- case MessageDeleteEditPart.VISUAL_ID:
- return getMessage_DeleteEdgeText(view);
- case MessageLostEditPart.VISUAL_ID:
- return getMessage_LostEdgeText(view);
- case MessageFoundEditPart.VISUAL_ID:
- return getMessage_FoundEdgeText(view);
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getComment_AnnotatedElementEdgeText(view);
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getConstraint_ConstrainedElementEdgeText(view);
- case GeneralOrderingEditPart.VISUAL_ID:
- return getGeneralOrdering_EdgeText(view);
- }
- return getUnknownElementText(view);
- }
-
- /**
- * @generated
- */
- private String getPackage_SequenceDiagramText(View view) {
- Package domainModelElement = (Package) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = Package_SequenceDiagram"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getInteraction_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Interaction_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Interaction_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getLifeline_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Lifeline_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(LifelineNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Lifeline_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getInteractionUse_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.InteractionUse_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(InteractionUseNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label InteractionUse_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getBehaviorExecutionSpecification_ShapeText(View view) {
- BehaviorExecutionSpecification domainModelElement = (BehaviorExecutionSpecification) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = BehaviorExecutionSpecification_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getCombinedFragment_ShapeText(View view) {
- CombinedFragment domainModelElement = (CombinedFragment) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = CombinedFragment_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getInteractionOperand_ShapeText(View view) {
- InteractionOperand domainModelElement = (InteractionOperand) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = InteractionOperand_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getActionExecutionSpecification_ShapeText(View view) {
- ActionExecutionSpecification domainModelElement = (ActionExecutionSpecification) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = ActionExecutionSpecification_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getConsiderIgnoreFragment_ShapeText(View view) {
- ConsiderIgnoreFragment domainModelElement = (ConsiderIgnoreFragment) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = ConsiderIgnoreFragment_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getConstraint_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Constraint_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getComment_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Comment_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Comment_BodyLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getContinuation_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Continuation_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(ContinuationNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Continuation_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getStateInvariant_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.StateInvariant_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(StateInvariantNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label StateInvariant_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getCombinedFragment_CoRegionShapeText(View view) {
- CombinedFragment domainModelElement = (CombinedFragment) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = CombinedFragment_CoRegionShape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getTimeConstraint_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.TimeConstraint_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(TimeConstraintLabelEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("Parser was not found for label TimeConstraint_ConstraintLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getTimeObservation_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(TimeObservationLabelEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label TimeObservation_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getDurationConstraint_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationConstraint_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(DurationConstraintLabelEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("Parser was not found for label DurationConstraint_BodyLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getDestructionOccurrenceSpecification_ShapeText(View view) {
- DestructionOccurrenceSpecification domainModelElement = (DestructionOccurrenceSpecification) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("No domain element for view with visualID = DestructionOccurrenceSpecification_Shape"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getDurationConstraint_Shape_CNText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationConstraint_Shape_CN,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("Parser was not found for label DurationConstraint_BodyLabel_CN"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getDurationObservation_ShapeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationObservation_Shape,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(DurationObservationLabelEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("Parser was not found for label DurationObservation_NameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_SynchEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_SynchEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageSyncNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_SynchNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_AsynchEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_AsynchEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageAsyncNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_AsynchNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_ReplyEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_ReplyEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageReplyNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_ReplyNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_CreateEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_CreateEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageCreateNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_CreateNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_DeleteEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_DeleteEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageDeleteNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_DeleteNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_LostEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_LostEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageLostNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_LostNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getMessage_FoundEdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_FoundEdge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(MessageFoundNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_FoundNameLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getComment_AnnotatedElementEdgeText(View view) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private String getConstraint_ConstrainedElementEdgeText(View view) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private String getGeneralOrdering_EdgeText(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.GeneralOrdering_Edge,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(GeneralOrderingAppliedStereotypeEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance()
- .logError("Parser was not found for label GeneralOrdering_StereotypeLabel"); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getUnknownElementText(View view) {
- return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- private String getUnresolvedDomainElementProxyText(View view) {
- return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- @Override
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- @Override
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- @Override
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- @Override
- public String getDescription(Object anElement) {
- return null;
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.navigator; + +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.viewers.ITreePathLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.ViewerLabel; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentBodyEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConsiderIgnoreFragmentEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageAsyncEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageAsyncNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageCreateEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageCreateNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageDeleteEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageDeleteNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageReplyEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageReplyNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageSyncEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageSyncNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.PackageEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantNameEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.navigator.ICommonContentExtensionSite; +import org.eclipse.ui.navigator.ICommonLabelProvider; +import org.eclipse.uml2.uml.ActionExecutionSpecification; +import org.eclipse.uml2.uml.BehaviorExecutionSpecification; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.ConsiderIgnoreFragment; +import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.Package; + +/** + * @generated + */ +public class UMLNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider { + + /** + * @generated + */ + static { + UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", //$NON-NLS-1$ + ImageDescriptor.getMissingImageDescriptor()); + UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", //$NON-NLS-1$ + ImageDescriptor.getMissingImageDescriptor()); + } + + /** + * @generated + */ + @Override + public void updateLabel(ViewerLabel label, TreePath elementPath) { + Object element = elementPath.getLastSegment(); + if (element instanceof UMLNavigatorItem && !isOwnView(((UMLNavigatorItem) element).getView())) { + return; + } + label.setText(getText(element)); + label.setImage(getImage(element)); + } + + /** + * @generated + */ + @Override + public Image getImage(Object element) { + if (element instanceof UMLNavigatorGroup) { + UMLNavigatorGroup group = (UMLNavigatorGroup) element; + return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon()); + } + + if (element instanceof UMLNavigatorItem) { + UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element; + if (!isOwnView(navigatorItem.getView())) { + return super.getImage(element); + } + return getImage(navigatorItem.getView()); + } + + return super.getImage(element); + } + + /** + * @generated + */ + public Image getImage(View view) { + switch (UMLVisualIDRegistry.getVisualID(view)) { + case PackageEditPart.VISUAL_ID: + return getImage("Navigator?Diagram?http://www.eclipse.org/uml2/5.0.0/UML?Package", //$NON-NLS-1$ + UMLElementTypes.Package_SequenceDiagram); + case InteractionEditPart.VISUAL_ID: + return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/5.0.0/UML?Interaction", //$NON-NLS-1$ + UMLElementTypes.Interaction_Shape); + case LifelineEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Lifeline", //$NON-NLS-1$ + UMLElementTypes.Lifeline_Shape); + case InteractionUseEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?InteractionUse", //$NON-NLS-1$ + UMLElementTypes.InteractionUse_Shape); + case BehaviorExecutionSpecificationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?BehaviorExecutionSpecification", //$NON-NLS-1$ + UMLElementTypes.BehaviorExecutionSpecification_Shape); + case CombinedFragmentEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?CombinedFragment", //$NON-NLS-1$ + UMLElementTypes.CombinedFragment_Shape); + case InteractionOperandEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?InteractionOperand", //$NON-NLS-1$ + UMLElementTypes.InteractionOperand_Shape); + case ActionExecutionSpecificationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?ActionExecutionSpecification", //$NON-NLS-1$ + UMLElementTypes.ActionExecutionSpecification_Shape); + case ConsiderIgnoreFragmentEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?ConsiderIgnoreFragment", //$NON-NLS-1$ + UMLElementTypes.ConsiderIgnoreFragment_Shape); + case ConstraintEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Constraint", //$NON-NLS-1$ + UMLElementTypes.Constraint_Shape); + case CommentEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Comment", //$NON-NLS-1$ + UMLElementTypes.Comment_Shape); + case ContinuationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?Continuation", //$NON-NLS-1$ + UMLElementTypes.Continuation_Shape); + case StateInvariantEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?StateInvariant", //$NON-NLS-1$ + UMLElementTypes.StateInvariant_Shape); + case CombinedFragment2EditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?CombinedFragment", //$NON-NLS-1$ + UMLElementTypes.CombinedFragment_CoRegionShape); + case TimeConstraintEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?TimeConstraint", //$NON-NLS-1$ + UMLElementTypes.TimeConstraint_Shape); + case TimeObservationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?TimeObservation", //$NON-NLS-1$ + UMLElementTypes.TimeObservation_Shape); + case DurationConstraintEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationConstraint", //$NON-NLS-1$ + UMLElementTypes.DurationConstraint_Shape); + case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DestructionOccurrenceSpecification", //$NON-NLS-1$ + UMLElementTypes.DestructionOccurrenceSpecification_Shape); + case DurationConstraintInMessageEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationConstraint", //$NON-NLS-1$ + UMLElementTypes.DurationConstraint_Shape_CN); + case DurationObservationEditPart.VISUAL_ID: + return getImage("Navigator?Node?http://www.eclipse.org/uml2/5.0.0/UML?DurationObservation", //$NON-NLS-1$ + UMLElementTypes.DurationObservation_Shape); + case MessageSyncEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_SynchEdge); + case MessageAsyncEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_AsynchEdge); + case MessageReplyEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_ReplyEdge); + case MessageCreateEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_CreateEdge); + case MessageDeleteEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_DeleteEdge); + case MessageLostEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_LostEdge); + case MessageFoundEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Message", //$NON-NLS-1$ + UMLElementTypes.Message_FoundEdge); + case CommentAnnotatedElementEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Comment?annotatedElement", //$NON-NLS-1$ + UMLElementTypes.Comment_AnnotatedElementEdge); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?Constraint?constrainedElement", //$NON-NLS-1$ + UMLElementTypes.Constraint_ConstrainedElementEdge); + case GeneralOrderingEditPart.VISUAL_ID: + return getImage("Navigator?Link?http://www.eclipse.org/uml2/5.0.0/UML?GeneralOrdering", //$NON-NLS-1$ + UMLElementTypes.GeneralOrdering_Edge); + } + return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$ + } + + /** + * @generated + */ + private Image getImage(String key, IElementType elementType) { + ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry(); + Image image = imageRegistry.get(key); + if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) { + image = UMLElementTypes.getImage(elementType); + imageRegistry.put(key, image); + } + + if (image == null) { + image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$ + imageRegistry.put(key, image); + } + return image; + } + + /** + * @generated + */ + @Override + public String getText(Object element) { + if (element instanceof UMLNavigatorGroup) { + UMLNavigatorGroup group = (UMLNavigatorGroup) element; + return group.getGroupName(); + } + + if (element instanceof UMLNavigatorItem) { + UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element; + if (!isOwnView(navigatorItem.getView())) { + return null; + } + return getText(navigatorItem.getView()); + } + + return super.getText(element); + } + + /** + * @generated + */ + public String getText(View view) { + if (view.getElement() != null && view.getElement().eIsProxy()) { + return getUnresolvedDomainElementProxyText(view); + } + switch (UMLVisualIDRegistry.getVisualID(view)) { + case PackageEditPart.VISUAL_ID: + return getPackage_SequenceDiagramText(view); + case InteractionEditPart.VISUAL_ID: + return getInteraction_ShapeText(view); + case LifelineEditPart.VISUAL_ID: + return getLifeline_ShapeText(view); + case InteractionUseEditPart.VISUAL_ID: + return getInteractionUse_ShapeText(view); + case BehaviorExecutionSpecificationEditPart.VISUAL_ID: + return getBehaviorExecutionSpecification_ShapeText(view); + case CombinedFragmentEditPart.VISUAL_ID: + return getCombinedFragment_ShapeText(view); + case InteractionOperandEditPart.VISUAL_ID: + return getInteractionOperand_ShapeText(view); + case ActionExecutionSpecificationEditPart.VISUAL_ID: + return getActionExecutionSpecification_ShapeText(view); + case ConsiderIgnoreFragmentEditPart.VISUAL_ID: + return getConsiderIgnoreFragment_ShapeText(view); + case ConstraintEditPart.VISUAL_ID: + return getConstraint_ShapeText(view); + case CommentEditPart.VISUAL_ID: + return getComment_ShapeText(view); + case ContinuationEditPart.VISUAL_ID: + return getContinuation_ShapeText(view); + case StateInvariantEditPart.VISUAL_ID: + return getStateInvariant_ShapeText(view); + case CombinedFragment2EditPart.VISUAL_ID: + return getCombinedFragment_CoRegionShapeText(view); + case TimeConstraintEditPart.VISUAL_ID: + return getTimeConstraint_ShapeText(view); + case TimeObservationEditPart.VISUAL_ID: + return getTimeObservation_ShapeText(view); + case DurationConstraintEditPart.VISUAL_ID: + return getDurationConstraint_ShapeText(view); + case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: + return getDestructionOccurrenceSpecification_ShapeText(view); + case DurationConstraintInMessageEditPart.VISUAL_ID: + return getDurationConstraint_Shape_CNText(view); + case DurationObservationEditPart.VISUAL_ID: + return getDurationObservation_ShapeText(view); + case MessageSyncEditPart.VISUAL_ID: + return getMessage_SynchEdgeText(view); + case MessageAsyncEditPart.VISUAL_ID: + return getMessage_AsynchEdgeText(view); + case MessageReplyEditPart.VISUAL_ID: + return getMessage_ReplyEdgeText(view); + case MessageCreateEditPart.VISUAL_ID: + return getMessage_CreateEdgeText(view); + case MessageDeleteEditPart.VISUAL_ID: + return getMessage_DeleteEdgeText(view); + case MessageLostEditPart.VISUAL_ID: + return getMessage_LostEdgeText(view); + case MessageFoundEditPart.VISUAL_ID: + return getMessage_FoundEdgeText(view); + case CommentAnnotatedElementEditPart.VISUAL_ID: + return getComment_AnnotatedElementEdgeText(view); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getConstraint_ConstrainedElementEdgeText(view); + case GeneralOrderingEditPart.VISUAL_ID: + return getGeneralOrdering_EdgeText(view); + } + return getUnknownElementText(view); + } + + /** + * @generated + */ + private String getPackage_SequenceDiagramText(View view) { + Package domainModelElement = (Package) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = Package_SequenceDiagram"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getInteraction_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Interaction_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Interaction_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getLifeline_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Lifeline_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(LifelineNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Lifeline_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getInteractionUse_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.InteractionUse_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(InteractionUseNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label InteractionUse_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getBehaviorExecutionSpecification_ShapeText(View view) { + BehaviorExecutionSpecification domainModelElement = (BehaviorExecutionSpecification) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = BehaviorExecutionSpecification_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getCombinedFragment_ShapeText(View view) { + CombinedFragment domainModelElement = (CombinedFragment) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = CombinedFragment_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getInteractionOperand_ShapeText(View view) { + InteractionOperand domainModelElement = (InteractionOperand) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = InteractionOperand_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getActionExecutionSpecification_ShapeText(View view) { + ActionExecutionSpecification domainModelElement = (ActionExecutionSpecification) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = ActionExecutionSpecification_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getConsiderIgnoreFragment_ShapeText(View view) { + ConsiderIgnoreFragment domainModelElement = (ConsiderIgnoreFragment) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = ConsiderIgnoreFragment_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getConstraint_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Constraint_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getComment_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Comment_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Comment_BodyLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getContinuation_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Continuation_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(ContinuationNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Continuation_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getStateInvariant_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.StateInvariant_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(StateInvariantNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label StateInvariant_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getCombinedFragment_CoRegionShapeText(View view) { + CombinedFragment domainModelElement = (CombinedFragment) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = CombinedFragment_CoRegionShape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getTimeConstraint_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.TimeConstraint_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(TimeConstraintLabelEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("Parser was not found for label TimeConstraint_ConstraintLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getTimeObservation_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(TimeObservationLabelEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label TimeObservation_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getDurationConstraint_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationConstraint_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(DurationConstraintLabelEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("Parser was not found for label DurationConstraint_BodyLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getDestructionOccurrenceSpecification_ShapeText(View view) { + DestructionOccurrenceSpecification domainModelElement = (DestructionOccurrenceSpecification) view.getElement(); + if (domainModelElement != null) { + return String.valueOf(UMLLabelInternationalization.getInstance().getLabel(domainModelElement)); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("No domain element for view with visualID = DestructionOccurrenceSpecification_Shape"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getDurationConstraint_Shape_CNText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationConstraint_Shape_CN, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("Parser was not found for label DurationConstraint_BodyLabel_CN"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getDurationObservation_ShapeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.DurationObservation_Shape, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(DurationObservationLabelEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("Parser was not found for label DurationObservation_NameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_SynchEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_SynchEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageSyncNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_SynchNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_AsynchEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_AsynchEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageAsyncNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_AsynchNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_ReplyEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_ReplyEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageReplyNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_ReplyNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_CreateEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_CreateEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageCreateNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_CreateNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_DeleteEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_DeleteEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageDeleteNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_DeleteNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_LostEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_LostEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageLostNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_LostNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getMessage_FoundEdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.Message_FoundEdge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(MessageFoundNameEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label Message_FoundNameLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getComment_AnnotatedElementEdgeText(View view) { + return ""; //$NON-NLS-1$ + } + + /** + * @generated + */ + private String getConstraint_ConstrainedElementEdgeText(View view) { + return ""; //$NON-NLS-1$ + } + + /** + * @generated + */ + private String getGeneralOrdering_EdgeText(View view) { + IParser parser = UMLParserProvider.getParser(UMLElementTypes.GeneralOrdering_Edge, + view.getElement() != null ? view.getElement() : view, + UMLVisualIDRegistry.getType(GeneralOrderingAppliedStereotypeEditPart.VISUAL_ID)); + if (parser != null) { + return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), + ParserOptions.NONE.intValue()); + } else { + UMLDiagramEditorPlugin.getInstance() + .logError("Parser was not found for label GeneralOrdering_StereotypeLabel"); //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + } + + /** + * @generated + */ + private String getUnknownElementText(View view) { + return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * @generated + */ + private String getUnresolvedDomainElementProxyText(View view) { + return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * @generated + */ + @Override + public void init(ICommonContentExtensionSite aConfig) { + } + + /** + * @generated + */ + @Override + public void restoreState(IMemento aMemento) { + } + + /** + * @generated + */ + @Override + public void saveState(IMemento aMemento) { + } + + /** + * @generated + */ + @Override + public String getDescription(Object anElement) { + return null; + } + + /** + * @generated + */ + private boolean isOwnView(View view) { + return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/parsers/MessageFormatParser.java index 8cda0440fff..52fc324e618 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/parsers/MessageFormatParser.java @@ -1,213 +1,261 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
-
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(
- getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(
- getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0))
- .toString();
- }
-
- /**
- * @generated
- */
- @Override
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE,
- NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.sequence.part.Messages; +import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + @Override + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + @Override + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat( + getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + @Override + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat( + getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + @Override + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)) + .toString(); + } + + /** + * @generated + */ + @Override + public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, + NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + @Override + public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { + Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + @Override + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF index ba481b104b1..7c06a6a53c8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF @@ -62,7 +62,9 @@ Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12 org.eclipse.emf.validation;visibility:=reexport, org.eclipse.gmf.tooling.runtime;visibility:=reexport, org.eclipse.gef, - org.eclipse.papyrus.extensionpoints.editors + org.eclipse.papyrus.extensionpoints.editors, + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Ant-Version: Apache Ant 1.7.0 Eclipse-LazyStart: true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java index 47b38356238..cd73ee7fad0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine; @@ -22,6 +23,7 @@ import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener; import org.eclipse.papyrus.uml.diagram.statemachine.custom.util.FixNestedStateAndRegionOnOpening; import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditor; @@ -90,7 +92,7 @@ public class UmlStateMachineDiagramForMultiEditor extends UMLDiagramEditor { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); - setPartName(getDiagram().getName()); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); titleImage = DIAG_IMG_DESC.createImage(); setTitleImage(titleImage); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java index 0d23b2c45be..487ad184468 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -16,6 +17,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.ConnectionPointReferenceFigure; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.ConnectionPointReference; import org.eclipse.uml2.uml.Pseudostate; @@ -44,7 +46,7 @@ public class CustomConnectionPointReferenceNameEditPart extends ConnectionPointR } else { first = false; } - label += p.getName(); + label += UMLLabelInternationalization.getInstance().getLabel(p); } } else if (!ref.getExits().isEmpty()) { boolean first = true; @@ -54,7 +56,7 @@ public class CustomConnectionPointReferenceNameEditPart extends ConnectionPointR } else { first = false; } - label += p.getName(); + label += UMLLabelInternationalization.getInstance().getLabel(p); } } return label; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java index 0917f662597..6d13e720ef9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -22,6 +23,7 @@ import org.eclipse.gmf.runtime.diagram.ui.internal.tools.RubberbandDragTracker; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomRegionCompartmentFigure; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.RegionCompartmentEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Region; public class CustomRegionCompartmentEditPart extends RegionCompartmentEditPart { @@ -78,7 +80,7 @@ public class CustomRegionCompartmentEditPart extends RegionCompartmentEditPart { View regionView = (View) ((View) getModel()).eContainer(); Region region = (Region) regionView.getElement(); - ((ResizableCompartmentFigure) getFigure()).setToolTip(region.getName()); + ((ResizableCompartmentFigure) getFigure()).setToolTip(UMLLabelInternationalization.getInstance().getLabel(region)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java index 195da33523f..03c590a4247 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -17,6 +18,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateCompartmentEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.State; public class CustomStateCompartmentEditPart extends StateCompartmentEditPart { @@ -55,7 +57,7 @@ public class CustomStateCompartmentEditPart extends StateCompartmentEditPart { if (stateView != null) { State state = (State) stateView.getElement(); - ((CustomStateCompartmentFigure) getFigure()).setToolTip(state.getName()); + ((CustomStateCompartmentFigure) getFigure()).setToolTip(UMLLabelInternationalization.getInstance().getLabel(state)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPartTN.java index c4e46d385ba..52bb00ddb53 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPartTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPartTN.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -17,6 +18,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateCompartmentEditPartTN; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.State; public class CustomStateCompartmentEditPartTN extends StateCompartmentEditPartTN { @@ -53,7 +55,7 @@ public class CustomStateCompartmentEditPartTN extends StateCompartmentEditPartTN if (stateView != null) { State state = (State) stateView.getElement(); - ((CustomStateCompartmentFigure) getFigure()).setToolTip(state.getName()); + ((CustomStateCompartmentFigure) getFigure()).setToolTip(UMLLabelInternationalization.getInstance().getLabel(state)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java index 666ad41fc2f..9537f11b83e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -17,6 +18,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.StateMachine; public class CustomStateMachineCompartmentEditPart extends StateMachineCompartmentEditPart { @@ -56,7 +58,7 @@ public class CustomStateMachineCompartmentEditPart extends StateMachineCompartme View smView = (View) ((View) getModel()).eContainer(); StateMachine sm = (StateMachine) smView.getElement(); - ((CustomStateCompartmentFigure) getFigure()).setToolTip(sm.getName()); + ((CustomStateCompartmentFigure) getFigure()).setToolTip(UMLLabelInternationalization.getInstance().getLabel(sm)); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java index 41820f6d86f..4fdc034e0ef 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -30,6 +31,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.StateFigure; import org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers.Zone; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateNameEditPart; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.State; /***************************************************************************** @@ -92,7 +94,7 @@ public class CustomStateNameEditPart extends StateNameEditPart { if (state.isSubmachineState()) { - stateFigure.setSubmachineStateName(state.getName() + " : " + state.getSubmachine().getQualifiedName()); + stateFigure.setSubmachineStateName(UMLLabelInternationalization.getInstance().getLabel(state) + " : " + state.getSubmachine().getQualifiedName()); stateFigure.setIsSubmachineState(true); } else { stateFigure.setIsSubmachineState(false); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPartTN.java index 1bf636d2bb4..2fc23679173 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPartTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPartTN.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part; @@ -31,6 +32,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers.Zone; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPartTN; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateNameEditPartTN; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.State; /***************************************************************************** @@ -93,7 +95,7 @@ public class CustomStateNameEditPartTN extends StateNameEditPartTN { if (state.isSubmachineState()) { - stateFigure.setSubmachineStateName(state.getName() + " : " + state.getSubmachine().getQualifiedName()); + stateFigure.setSubmachineStateName(UMLLabelInternationalization.getInstance().getLabel(state) + " : " + state.getSubmachine().getQualifiedName()); stateFigure.setIsSubmachineState(true); } else { stateFigure.setIsSubmachineState(false); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/AbstractStateBehaviorsParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/AbstractStateBehaviorsParser.java index 9cedd6fd6ec..bae1f7e420e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/AbstractStateBehaviorsParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/AbstractStateBehaviorsParser.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers; @@ -34,6 +35,8 @@ import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Behavior; import org.eclipse.uml2.uml.OpaqueBehavior; @@ -92,7 +95,7 @@ public abstract class AbstractStateBehaviorsParser implements ISemanticParser { Object obj = element.getAdapter(Behavior.class); if (obj instanceof Behavior) { final Behavior behavior = ((Behavior) obj); - return behavior.getName(); + return UMLLabelInternationalization.getInstance().getLabel(behavior); } return EMPTY_STRING; } @@ -121,7 +124,11 @@ public abstract class AbstractStateBehaviorsParser implements ISemanticParser { AbstractTransactionalCommand cmd = new AbstractTransactionalCommand((TransactionalEditingDomain) editingDomain, "Set new name in " + behavior.getName(), null) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - behavior.setName(newStringResult); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(behavior) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(behavior)) { + UMLLabelInternationalization.getInstance().setLabel(behavior, newStringResult, null); + }else{ + behavior.setName(newStringResult); + } return CommandResult.newOKCommandResult(); } }; @@ -165,7 +172,7 @@ public abstract class AbstractStateBehaviorsParser implements ISemanticParser { result.append(kind); addExtraSpace(result, kind); // Append behavior name - result.append(behavior.getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(behavior)); } return result.toString(); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/InternalTransitionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/InternalTransitionParser.java index 4407bfb206d..9e53b7170c5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/InternalTransitionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/InternalTransitionParser.java @@ -8,12 +8,14 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Transition; /** @@ -37,7 +39,7 @@ public class InternalTransitionParser extends TransitionPropertiesParser { boolean noGuard = tran.getGuard() == null; boolean noEffect = tran.getEffect() == null; if (noEffect && noGuard && noTrigger) { - return tran.getName(); + return UMLLabelInternationalization.getInstance().getLabel(tran); } } return super.getValueString(element, flags); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java index 71e0dd91e4a..2be5fd069b2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java @@ -9,6 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Jeremie TATIBOUET (CEA LIST) - Fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=477573 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers; @@ -41,9 +42,11 @@ import org.eclipse.jface.util.SafeRunnable; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.CSSOptionsConstants; import org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.PreferenceConstants; import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; import org.eclipse.uml2.uml.Behavior; import org.eclipse.uml2.uml.CallEvent; @@ -111,7 +114,11 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser { // 2. no constraint exists already if (guardConstraint == null) { guardConstraint = UMLFactory.eINSTANCE.createConstraint(); - guardConstraint.setName(result); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(guardConstraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(guardConstraint)) { + UMLLabelInternationalization.getInstance().setLabel(guardConstraint, result, null); + }else{ + guardConstraint.setName(result); + } guardConstraint.setContext(transition.getNamespace()); transition.setGuard(guardConstraint); } @@ -197,7 +204,7 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser { value = ValueSpecificationUtil.getConstraintnValue(constraint); } else { - String name = constraint.getName(); + String name = UMLLabelInternationalization.getInstance().getLabel(constraint); if (name == null) { name = "<undef>"; //$NON-NLS-1$ } @@ -230,7 +237,7 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser { } } if (eClass != null) { - result.append(eClass.getName()).append(": ").append(effect.getName()); //$NON-NLS-1$ + result.append(eClass.getName()).append(": ").append(UMLLabelInternationalization.getInstance().getLabel(effect)); //$NON-NLS-1$ } } return result.toString(); @@ -256,22 +263,22 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser { if (e instanceof CallEvent) { Operation op = ((CallEvent) e).getOperation(); if (op != null) { - result.append(op.getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(op)); if ((op.getOwnedParameters().size() > 0) && OpaqueBehaviorViewUtil.displayParamDots(view)) { result.append(OpaqueBehaviorViewUtil.PARAM_DOTS); } } else { - result.append(((CallEvent) e).getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(((CallEvent) e))); } } else if (e instanceof SignalEvent) { Signal signal = ((SignalEvent) e).getSignal(); if (signal != null) { - result.append(signal.getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(signal)); if ((signal.getAttributes().size() > 0) && OpaqueBehaviorViewUtil.displayParamDots(view)) { result.append(OpaqueBehaviorViewUtil.PARAM_DOTS); } } else { - result.append(((SignalEvent) e).getName()); + result.append(UMLLabelInternationalization.getInstance().getLabel(((SignalEvent) e))); } } else if (e instanceof ChangeEvent) { ValueSpecification vs = ((ChangeEvent) e).getChangeExpression(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java index bb8b39ad497..dce40257884 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.statemachine.part.Messages; import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -204,4 +212,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF index 15ce6e974f6..a25ad341f08 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF @@ -1,12 +1,13 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart, org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies, - org.eclipse.papyrus.uml.diagram.stereotype.edition.internal.edithelper.advice;x-internal:=true,
+ org.eclipse.papyrus.uml.diagram.stereotype.edition.internal.edithelper.advice;x-internal:=true, org.eclipse.papyrus.uml.diagram.stereotype.edition.provider Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.appearance;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.types;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java index 7052d14459a..1bb3b780df3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java @@ -10,6 +10,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 460356 : Refactor Stereotype Display + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart; @@ -34,6 +35,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartme import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeCompartmentFigure; import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Stereotype; /** @@ -75,7 +77,7 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm //View label = helper.getStereotypeLabel((View) compartment.eContainer(), stereotype); //change when the file is reopened the label is not created //this editpart must not depends on a node that is not its parent. - name = StereotypeDisplayConstant.QUOTE_LEFT + stereotype.getName() + StereotypeDisplayConstant.QUOTE_RIGHT; + name = StereotypeDisplayConstant.QUOTE_LEFT + UMLLabelInternationalization.getInstance().getKeyword(stereotype) + StereotypeDisplayConstant.QUOTE_RIGHT; } } return name; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java index e67edba5a02..b198136cd62 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java @@ -1,573 +1,575 @@ -/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.provider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
-import org.eclipse.papyrus.uml.profile.ImageManager;
-import org.eclipse.papyrus.uml.profile.Message;
-import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypeTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.BooleanValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.DataTypeValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.EnumerationValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.IntegerValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.MetaclassValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.PrimitiveTypeValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.StereotypeValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.StringValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.UnlimitedNaturalValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.UserPrimitiveTypeValueTreeObject;
-import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject;
-import org.eclipse.papyrus.uml.profile.utils.Util;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Enumeration;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * The Class ProfileElementLabelProvider.
- */
-public class DisplayedProfileElementLabelProvider extends LabelProvider {
-
-
- private StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
-
-
- private View mainView;
-
- /**
- * @return the mainView
- */
- public View getMainView() {
- return mainView;
- }
-
- /**
- * @param mainView
- * the mainView to set
- */
- public void setMainView(View mainView) {
- this.mainView = mainView;
- }
-
- /**
- * @return the qualifiedNameDisplay
- */
- public boolean isQualifiedNameDisplay(View labelView) {
-
- String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayConstant.DEFAULT_DEPTH_VALUE);
-
- return StereotypeDisplayConstant.DEPTH_MAX.equals(depth);
- }
-
-
- /** The Constant TAB. */
- public static final String TAB = " ";
-
- /**
- * Gets the image.
- *
- * @param object
- * the object
- *
- * @return the image
- */
- @Override
- public Image getImage(Object object) {
- Image image = null;
- // If the object is an Applied Stereotype Tree Object
- if (object instanceof AppliedStereotypeTreeObject) {
- Stereotype stereotype = ((AppliedStereotypeTreeObject) object).getStereotype();
- // retrieve the StereotypeLabel Node
- View labelView = helper.getStereotypeLabel(mainView, stereotype);
- // if the Label is visible, check if the Qualified Name is displayed
- // and set the Stereotype Image accordingly.
- if (labelView != null && labelView.isVisible()) {
- if (isQualifiedNameDisplay(labelView)) {
- image = ImageManager.DISPLAYED_STEREOTYPE_QN;
- } else {
- image = ImageManager.IMG_STEREOTYPEDISPLAYED;
- }
- } else { // If the Label is not visible the Image is the default Stereotype image
- image = ImageManager.IMG_STEREOTYPE;
- }
-
- return image;
-
- // If the object is a Stereotype Property
- } else if (object instanceof AppliedStereotypePropertyTreeObject) {
- Property property = ((AppliedStereotypePropertyTreeObject) object).getProperty();
- Stereotype stereotype = ((AppliedStereotypePropertyTreeObject) object).getStereotype();
- View compartmentView = helper.getStereotypeCompartment(mainView, stereotype);
- View propertyView = helper.getStereotypeProperty(mainView, stereotype, property);
- // check if the Property is displayed, set the image accordingly
- if (propertyView != null && propertyView.isVisible() && compartmentView.isVisible()) {
- image = ImageManager.IMG_DISPLAYEDPROPERTY;
- } else {
- image = ImageManager.IMG_PROPERTY;
- }
- return image;
-
- } else if (object instanceof BooleanValueTreeObject) {
- return ImageManager.IMG_LITERALBOOLEAN;
- } else if (object instanceof StringValueTreeObject) {
- return ImageManager.IMG_LITERALSTRING;
- } else if (object instanceof IntegerValueTreeObject) {
- return ImageManager.IMG_LITERALINTEGER;
- } else if (object instanceof UnlimitedNaturalValueTreeObject) {
- return ImageManager.IMG_LITERALUNLIMITEDNATURAL;
- } else if (object instanceof UserPrimitiveTypeValueTreeObject) {
- return ImageManager.IMG_PRIMITIVETYPE;
- } else if (object instanceof EnumerationValueTreeObject) {
- return ImageManager.IMG_ENUMERATION;
- } else if (object instanceof DataTypeValueTreeObject) {
- return ImageManager.IMG_DATATYPE;
- } else if (object instanceof StereotypeValueTreeObject) {
- return ImageManager.IMG_STEREOTYPEPROPERTY;
- } else if (object instanceof MetaclassValueTreeObject) {
- return ImageManager.IMG_METACLASS;
- } else {
- return ImageManager.IMG_UNKNOWN;
- }
-
- }
-
- /**
- * Gets the text.
- *
- * @param object
- * the object
- *
- * @return the text
- */
- @Override
- public String getText(Object object) {
-
- if (object == null) {
- return "null";
- }
-
- if (object instanceof AppliedStereotypeTreeObject) {
- Stereotype st = ((AppliedStereotypeTreeObject) object).getStereotype();
- String stName = st.getName();
- String profileName = st.getProfile().getQualifiedName();
- String label = stName + TAB + "(from " + profileName + ")";
- return label;
-
- } else if (object instanceof AppliedStereotypePropertyTreeObject) {
- AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject) object;
- Property prop = pTO.getProperty();
- Type propType = prop.getType();
- Object propValue = pTO.getValue();
-
- return getPropLabel(prop, propType, propValue);
-
- } else if (object instanceof ValueTreeObject) {
- return getLabel((ValueTreeObject) object);
-
- } else {
- return object.toString();
- }
- }
-
- /**
- * Returns the label to show for a property.
- *
- * @param currentPropType
- * current property type
- * @param currentProp
- * current property
- * @param currentPropValue
- * current property value
- *
- * @return the String label
- */
- private String getPropLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
-
- String label = getPropertyShortLabel(currentProp);
-
- if (currentPropValue == null) {
- label = label + " = null";
- return label;
- }
-
- // Test property type
- // Various cases possible for property type
- // property is an enumeration
- // property is a metaclass
- // property is a stereotype
- // property is a composite class
- // default case
- if (currentPropType instanceof Enumeration) {
- label = getPropEnumerationLabel(currentProp, currentPropType, currentPropValue);
- } else if (currentPropType instanceof Stereotype) {
- label = getPropStereotypeLabel(currentProp, currentPropType, currentPropValue);
- } else if (currentPropType instanceof Class) {
- label = getPropClassLabel(currentProp, currentPropType, currentPropValue);
- } else {
- label = getPropDefaultLabel(currentProp, currentPropValue);
- }
-
- return label;
- }
-
- /**
- * Returns the label to show for a property with type that is a Enumeration.
- *
- * @param currentPropType
- * current property type
- * @param currentProp
- * current property
- * @param currentPropValue
- * current property value
- *
- * @return the String label
- */
- private String getPropEnumerationLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
- String label = getPropertyShortLabel(currentProp);
-
- if (currentProp.getUpper() == 1) { // Multiplicity = 1
- if (currentPropValue != null) {
- // Retrieve literal
- if (currentPropValue instanceof EnumerationLiteral) {
- label = label + " = " + ((EnumerationLiteral) currentPropValue).getLabel();
- } else {
- label = label + " = " + currentPropValue;
- }
- }
-
- } else { // Multiplicity > 1
- label = label + " = " + currentPropValue;
- }
-
- return label;
- }
-
- /**
- * Returns the label to show for a property with type that is a Stereotype.
- *
- * @param currentPropType
- * current property type
- * @param currentProp
- * current property
- * @param currentPropValue
- * current property value
- *
- * @return the String label
- */
- private String getPropStereotypeLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
- String label = getPropertyShortLabel(currentProp);
-
- if (currentProp.getUpper() == 1) { // Multiplicity = 1
-
- // retrieve the base element from the stereotype application
- Element baseElement = UMLUtil.getBaseElement((EObject) currentPropValue);
- // display the base element's qualified name
- label = label + " = " + Util.getLabel(baseElement, true);
-
- } else { // Multiplicity > 1
-
- // retrieve the base element from the stereotype application
- @SuppressWarnings("unchecked")
- List<Object> values = (List<Object>) currentPropValue;
- ArrayList<String> baseElements = new ArrayList<String>();
-
- for (int i = 0; i < values.size(); i++) {
- // display the base element's qualified name
- Element baseElement = UMLUtil.getBaseElement((EObject) values.get(i));
- String name = Util.getLabel(baseElement, true);
- if (name != null) {
- baseElements.add(name);
- }
- }
-
- label = label + " = " + baseElements;
- }
-
- return label;
- }
-
- /**
- * Returns the label to show for a property with type that is a Metaclass or Composite.
- *
- * @param currentPropType
- * current property type
- * @param currentProp
- * current property
- * @param currentPropValue
- * current property value
- *
- * @return the String label
- */
- private String getPropClassLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
- String label = getPropertyShortLabel(currentProp);
-
- if (Util.isMetaclass(currentPropType)) {
- if (currentProp.getUpper() == 1) { // Multiplicity = 1
- label = label + " = " + Util.getLabel(currentPropValue, true);
-
- } else { // Multiplicity > 1
-
- @SuppressWarnings("unchecked")
- List<Object> values = (List<Object>) currentPropValue;
- ArrayList<String> elementNames = new ArrayList<String>();
- if (values != null) {
- for (int i = 0; i < values.size(); i++) {
- elementNames.add(Util.getLabel(values.get(i), true));
- }
- }
-
- label = label + " = " + elementNames;
- }
- }
-
- return label;
- }
-
- /**
- * Returns the label to show for a property with type that is neither Metaclass / Composite / Enumeration / Stereotype.
- *
- * @param currentProp
- * current property
- * @param currentPropValue
- * current property value
- *
- * @return the String label
- */
- private String getPropDefaultLabel(Property currentProp, Object currentPropValue) {
- String label = getPropertyShortLabel(currentProp);
-
- if (currentPropValue != null) {
- label = label + " = " + currentPropValue;
- }
-
- return label;
- }
-
- /**
- * Creates the label based on type + multiplicity for the selected property.
- *
- * @param property
- * the property
- *
- * @return the property short label
- */
- private String getPropertyShortLabel(Property property) {
-
- String label = "";
-
- int upper = property.getUpper();
- int lower = property.getLower();
-
- Type type = property.getType();
-
- String typeName = type.getName();
- String name = property.getName();
-
- if (upper != -1) {
- label = name + ": " + typeName + " " + "[" + lower + ".." + upper + "]";
- } else {
- label = name + ": " + typeName + " " + "[" + lower + "..*]";
- }
-
- return label;
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(ValueTreeObject object) {
-
- if (object instanceof PrimitiveTypeValueTreeObject) {
- return getLabel((PrimitiveTypeValueTreeObject) object);
- } else if (object instanceof EnumerationValueTreeObject) {
- return getLabel((EnumerationValueTreeObject) object);
- } else if (object instanceof DataTypeValueTreeObject) {
- return getLabel((DataTypeValueTreeObject) object);
- } else if (object instanceof StereotypeValueTreeObject) {
- return getLabel((StereotypeValueTreeObject) object);
- } else if (object instanceof MetaclassValueTreeObject) {
- return getLabel((MetaclassValueTreeObject) object);
- } // else
- return object.getValue().toString();
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(PrimitiveTypeValueTreeObject object) {
-
- Object value = object.getValue();
- if (value != null) {
- return value.toString();
- }
-
- return "undefined";
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(DataTypeValueTreeObject object) {
-
- Object value = object.getValue();
- if (value != null) {
- return value.toString();
- }
-
- return "undefined";
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(EnumerationValueTreeObject object) {
- EnumerationValueTreeObject eTO = object;
- Property property = ((AppliedStereotypePropertyTreeObject) eTO.getParent()).getProperty();
- Object value = eTO.getValue();
-
- EnumerationLiteral eLiteral = null;
- // Prepare Item data
- if (value instanceof EnumerationLiteral) {
- eLiteral = (EnumerationLiteral) value;
-
- } else if (value instanceof EEnumLiteral) {
- EEnumLiteral eEnumLiteral = (EEnumLiteral) value;
- Object tmp = Util.getValueObjectFromString(eEnumLiteral.getName(), property.getType());
- eLiteral = ((EnumerationLiteral) tmp);
-
- } else if (value instanceof String) {
- String literalString = (String) value;
- Object tmp = Util.getValueObjectFromString(literalString, property.getType());
- eLiteral = ((EnumerationLiteral) tmp);
-
- } else if (value instanceof Enumerator) { // Enumeration in static profile
- String literalString = ((Enumerator) value).getLiteral();
- Object tmp = Util.getValueObjectFromString(literalString, property.getType());
- eLiteral = ((EnumerationLiteral) tmp);
-
- } else { // Error
- String err = "Value " + value.toString() + " of Property " + property.getName() + " is not an EnumerationLiteral.";
- Message.error(err);
- }
-
- if (eLiteral != null) {
- return eLiteral.getName();
- } else {
- return "undefined";
- }
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(StereotypeValueTreeObject object) {
- StereotypeValueTreeObject sTO = object;
- Property property = ((AppliedStereotypePropertyTreeObject) sTO.getParent()).getProperty();
- Object value = sTO.getValue();
-
- Element baseElement = null;
-
- if (value instanceof EObject) {
- // retrieve the base element from the stereotype application
- baseElement = UMLUtil.getBaseElement((EObject) value);
-
- } else { // Error
- String err = "Type " + value.toString() + " of Property " + property.getName() + " is not an EObject.";
- Message.error(err);
- }
-
- if (baseElement != null) {
- String label = baseElement.toString();
- if (baseElement instanceof ValueSpecification) {
- return Util.getOriginLabel((ValueSpecification) baseElement);
-
- } else if (baseElement instanceof NamedElement) {
- NamedElement baseNamedElement = (NamedElement) baseElement;
- if (baseNamedElement.isSetName()) {
- label = baseNamedElement.getQualifiedName();
- }
- }
-
- return label;
- }
-
- return "undefined";
- }
-
- /**
- * Gets the label.
- *
- * @param object
- * the object
- *
- * @return the label
- */
- private String getLabel(MetaclassValueTreeObject object) {
- MetaclassValueTreeObject sTO = object;
- Object value = sTO.getValue();
-
- if (value instanceof ValueSpecification) {
- return Util.getOriginLabel((ValueSpecification) value);
-
- } else if (value instanceof Element) {
- return Util.getLabel(value, false);
- }
-
- return "undefined";
- }
-}
+/***************************************************************************** + * Copyright (c) 2008 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.stereotype.edition.provider; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant; +import org.eclipse.papyrus.uml.profile.ImageManager; +import org.eclipse.papyrus.uml.profile.Message; +import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypeTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.BooleanValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.DataTypeValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.EnumerationValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.IntegerValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.MetaclassValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.PrimitiveTypeValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.StereotypeValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.StringValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.UnlimitedNaturalValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.UserPrimitiveTypeValueTreeObject; +import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject; +import org.eclipse.papyrus.uml.profile.utils.Util; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Enumeration; +import org.eclipse.uml2.uml.EnumerationLiteral; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.ValueSpecification; +import org.eclipse.uml2.uml.util.UMLUtil; + +/** + * The Class ProfileElementLabelProvider. + */ +public class DisplayedProfileElementLabelProvider extends LabelProvider { + + + private StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance(); + + + private View mainView; + + /** + * @return the mainView + */ + public View getMainView() { + return mainView; + } + + /** + * @param mainView + * the mainView to set + */ + public void setMainView(View mainView) { + this.mainView = mainView; + } + + /** + * @return the qualifiedNameDisplay + */ + public boolean isQualifiedNameDisplay(View labelView) { + + String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayConstant.DEFAULT_DEPTH_VALUE); + + return StereotypeDisplayConstant.DEPTH_MAX.equals(depth); + } + + + /** The Constant TAB. */ + public static final String TAB = " "; + + /** + * Gets the image. + * + * @param object + * the object + * + * @return the image + */ + @Override + public Image getImage(Object object) { + Image image = null; + // If the object is an Applied Stereotype Tree Object + if (object instanceof AppliedStereotypeTreeObject) { + Stereotype stereotype = ((AppliedStereotypeTreeObject) object).getStereotype(); + // retrieve the StereotypeLabel Node + View labelView = helper.getStereotypeLabel(mainView, stereotype); + // if the Label is visible, check if the Qualified Name is displayed + // and set the Stereotype Image accordingly. + if (labelView != null && labelView.isVisible()) { + if (isQualifiedNameDisplay(labelView)) { + image = ImageManager.DISPLAYED_STEREOTYPE_QN; + } else { + image = ImageManager.IMG_STEREOTYPEDISPLAYED; + } + } else { // If the Label is not visible the Image is the default Stereotype image + image = ImageManager.IMG_STEREOTYPE; + } + + return image; + + // If the object is a Stereotype Property + } else if (object instanceof AppliedStereotypePropertyTreeObject) { + Property property = ((AppliedStereotypePropertyTreeObject) object).getProperty(); + Stereotype stereotype = ((AppliedStereotypePropertyTreeObject) object).getStereotype(); + View compartmentView = helper.getStereotypeCompartment(mainView, stereotype); + View propertyView = helper.getStereotypeProperty(mainView, stereotype, property); + // check if the Property is displayed, set the image accordingly + if (propertyView != null && propertyView.isVisible() && compartmentView.isVisible()) { + image = ImageManager.IMG_DISPLAYEDPROPERTY; + } else { + image = ImageManager.IMG_PROPERTY; + } + return image; + + } else if (object instanceof BooleanValueTreeObject) { + return ImageManager.IMG_LITERALBOOLEAN; + } else if (object instanceof StringValueTreeObject) { + return ImageManager.IMG_LITERALSTRING; + } else if (object instanceof IntegerValueTreeObject) { + return ImageManager.IMG_LITERALINTEGER; + } else if (object instanceof UnlimitedNaturalValueTreeObject) { + return ImageManager.IMG_LITERALUNLIMITEDNATURAL; + } else if (object instanceof UserPrimitiveTypeValueTreeObject) { + return ImageManager.IMG_PRIMITIVETYPE; + } else if (object instanceof EnumerationValueTreeObject) { + return ImageManager.IMG_ENUMERATION; + } else if (object instanceof DataTypeValueTreeObject) { + return ImageManager.IMG_DATATYPE; + } else if (object instanceof StereotypeValueTreeObject) { + return ImageManager.IMG_STEREOTYPEPROPERTY; + } else if (object instanceof MetaclassValueTreeObject) { + return ImageManager.IMG_METACLASS; + } else { + return ImageManager.IMG_UNKNOWN; + } + + } + + /** + * Gets the text. + * + * @param object + * the object + * + * @return the text + */ + @Override + public String getText(Object object) { + + if (object == null) { + return "null"; + } + + if (object instanceof AppliedStereotypeTreeObject) { + Stereotype st = ((AppliedStereotypeTreeObject) object).getStereotype(); + String stName = UMLLabelInternationalization.getInstance().getKeyword(st); + String profileName = st.getProfile().getQualifiedName(); + String label = stName + TAB + "(from " + profileName + ")"; + return label; + + } else if (object instanceof AppliedStereotypePropertyTreeObject) { + AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject) object; + Property prop = pTO.getProperty(); + Type propType = prop.getType(); + Object propValue = pTO.getValue(); + + return getPropLabel(prop, propType, propValue); + + } else if (object instanceof ValueTreeObject) { + return getLabel((ValueTreeObject) object); + + } else { + return object.toString(); + } + } + + /** + * Returns the label to show for a property. + * + * @param currentPropType + * current property type + * @param currentProp + * current property + * @param currentPropValue + * current property value + * + * @return the String label + */ + private String getPropLabel(Property currentProp, Type currentPropType, Object currentPropValue) { + + String label = getPropertyShortLabel(currentProp); + + if (currentPropValue == null) { + label = label + " = null"; + return label; + } + + // Test property type + // Various cases possible for property type + // property is an enumeration + // property is a metaclass + // property is a stereotype + // property is a composite class + // default case + if (currentPropType instanceof Enumeration) { + label = getPropEnumerationLabel(currentProp, currentPropType, currentPropValue); + } else if (currentPropType instanceof Stereotype) { + label = getPropStereotypeLabel(currentProp, currentPropType, currentPropValue); + } else if (currentPropType instanceof Class) { + label = getPropClassLabel(currentProp, currentPropType, currentPropValue); + } else { + label = getPropDefaultLabel(currentProp, currentPropValue); + } + + return label; + } + + /** + * Returns the label to show for a property with type that is a Enumeration. + * + * @param currentPropType + * current property type + * @param currentProp + * current property + * @param currentPropValue + * current property value + * + * @return the String label + */ + private String getPropEnumerationLabel(Property currentProp, Type currentPropType, Object currentPropValue) { + String label = getPropertyShortLabel(currentProp); + + if (currentProp.getUpper() == 1) { // Multiplicity = 1 + if (currentPropValue != null) { + // Retrieve literal + if (currentPropValue instanceof EnumerationLiteral) { + label = label + " = " + ((EnumerationLiteral) currentPropValue).getLabel(); + } else { + label = label + " = " + currentPropValue; + } + } + + } else { // Multiplicity > 1 + label = label + " = " + currentPropValue; + } + + return label; + } + + /** + * Returns the label to show for a property with type that is a Stereotype. + * + * @param currentPropType + * current property type + * @param currentProp + * current property + * @param currentPropValue + * current property value + * + * @return the String label + */ + private String getPropStereotypeLabel(Property currentProp, Type currentPropType, Object currentPropValue) { + String label = getPropertyShortLabel(currentProp); + + if (currentProp.getUpper() == 1) { // Multiplicity = 1 + + // retrieve the base element from the stereotype application + Element baseElement = UMLUtil.getBaseElement((EObject) currentPropValue); + // display the base element's qualified name + label = label + " = " + Util.getLabel(baseElement, true); + + } else { // Multiplicity > 1 + + // retrieve the base element from the stereotype application + @SuppressWarnings("unchecked") + List<Object> values = (List<Object>) currentPropValue; + ArrayList<String> baseElements = new ArrayList<String>(); + + for (int i = 0; i < values.size(); i++) { + // display the base element's qualified name + Element baseElement = UMLUtil.getBaseElement((EObject) values.get(i)); + String name = Util.getLabel(baseElement, true); + if (name != null) { + baseElements.add(name); + } + } + + label = label + " = " + baseElements; + } + + return label; + } + + /** + * Returns the label to show for a property with type that is a Metaclass or Composite. + * + * @param currentPropType + * current property type + * @param currentProp + * current property + * @param currentPropValue + * current property value + * + * @return the String label + */ + private String getPropClassLabel(Property currentProp, Type currentPropType, Object currentPropValue) { + String label = getPropertyShortLabel(currentProp); + + if (Util.isMetaclass(currentPropType)) { + if (currentProp.getUpper() == 1) { // Multiplicity = 1 + label = label + " = " + Util.getLabel(currentPropValue, true); + + } else { // Multiplicity > 1 + + @SuppressWarnings("unchecked") + List<Object> values = (List<Object>) currentPropValue; + ArrayList<String> elementNames = new ArrayList<String>(); + if (values != null) { + for (int i = 0; i < values.size(); i++) { + elementNames.add(Util.getLabel(values.get(i), true)); + } + } + + label = label + " = " + elementNames; + } + } + + return label; + } + + /** + * Returns the label to show for a property with type that is neither Metaclass / Composite / Enumeration / Stereotype. + * + * @param currentProp + * current property + * @param currentPropValue + * current property value + * + * @return the String label + */ + private String getPropDefaultLabel(Property currentProp, Object currentPropValue) { + String label = getPropertyShortLabel(currentProp); + + if (currentPropValue != null) { + label = label + " = " + currentPropValue; + } + + return label; + } + + /** + * Creates the label based on type + multiplicity for the selected property. + * + * @param property + * the property + * + * @return the property short label + */ + private String getPropertyShortLabel(Property property) { + + String label = ""; + + int upper = property.getUpper(); + int lower = property.getLower(); + + Type type = property.getType(); + + String typeName = UMLLabelInternationalization.getInstance().getLabel(type); + String name = UMLLabelInternationalization.getInstance().getLabel(property); + + if (upper != -1) { + label = name + ": " + typeName + " " + "[" + lower + ".." + upper + "]"; + } else { + label = name + ": " + typeName + " " + "[" + lower + "..*]"; + } + + return label; + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(ValueTreeObject object) { + + if (object instanceof PrimitiveTypeValueTreeObject) { + return getLabel((PrimitiveTypeValueTreeObject) object); + } else if (object instanceof EnumerationValueTreeObject) { + return getLabel((EnumerationValueTreeObject) object); + } else if (object instanceof DataTypeValueTreeObject) { + return getLabel((DataTypeValueTreeObject) object); + } else if (object instanceof StereotypeValueTreeObject) { + return getLabel((StereotypeValueTreeObject) object); + } else if (object instanceof MetaclassValueTreeObject) { + return getLabel((MetaclassValueTreeObject) object); + } // else + return object.getValue().toString(); + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(PrimitiveTypeValueTreeObject object) { + + Object value = object.getValue(); + if (value != null) { + return value.toString(); + } + + return "undefined"; + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(DataTypeValueTreeObject object) { + + Object value = object.getValue(); + if (value != null) { + return value.toString(); + } + + return "undefined"; + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(EnumerationValueTreeObject object) { + EnumerationValueTreeObject eTO = object; + Property property = ((AppliedStereotypePropertyTreeObject) eTO.getParent()).getProperty(); + Object value = eTO.getValue(); + + EnumerationLiteral eLiteral = null; + // Prepare Item data + if (value instanceof EnumerationLiteral) { + eLiteral = (EnumerationLiteral) value; + + } else if (value instanceof EEnumLiteral) { + EEnumLiteral eEnumLiteral = (EEnumLiteral) value; + Object tmp = Util.getValueObjectFromString(eEnumLiteral.getName(), property.getType()); + eLiteral = ((EnumerationLiteral) tmp); + + } else if (value instanceof String) { + String literalString = (String) value; + Object tmp = Util.getValueObjectFromString(literalString, property.getType()); + eLiteral = ((EnumerationLiteral) tmp); + + } else if (value instanceof Enumerator) { // Enumeration in static profile + String literalString = ((Enumerator) value).getLiteral(); + Object tmp = Util.getValueObjectFromString(literalString, property.getType()); + eLiteral = ((EnumerationLiteral) tmp); + + } else { // Error + String err = "Value " + value.toString() + " of Property " + property.getName() + " is not an EnumerationLiteral."; + Message.error(err); + } + + if (eLiteral != null) { + return UMLLabelInternationalization.getInstance().getLabel(eLiteral); + } else { + return "undefined"; + } + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(StereotypeValueTreeObject object) { + StereotypeValueTreeObject sTO = object; + Property property = ((AppliedStereotypePropertyTreeObject) sTO.getParent()).getProperty(); + Object value = sTO.getValue(); + + Element baseElement = null; + + if (value instanceof EObject) { + // retrieve the base element from the stereotype application + baseElement = UMLUtil.getBaseElement((EObject) value); + + } else { // Error + String err = "Type " + value.toString() + " of Property " + property.getName() + " is not an EObject."; + Message.error(err); + } + + if (baseElement != null) { + String label = baseElement.toString(); + if (baseElement instanceof ValueSpecification) { + return Util.getOriginLabel((ValueSpecification) baseElement); + + } else if (baseElement instanceof NamedElement) { + NamedElement baseNamedElement = (NamedElement) baseElement; + if (baseNamedElement.isSetName()) { + label = baseNamedElement.getQualifiedName(); + } + } + + return label; + } + + return "undefined"; + } + + /** + * Gets the label. + * + * @param object + * the object + * + * @return the label + */ + private String getLabel(MetaclassValueTreeObject object) { + MetaclassValueTreeObject sTO = object; + Object value = sTO.getValue(); + + if (value instanceof ValueSpecification) { + return Util.getOriginLabel((ValueSpecification) value); + + } else if (value instanceof Element) { + return Util.getLabel(value, false); + } + + return "undefined"; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF index 78ebdc61396..0eb08eed5e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF @@ -33,7 +33,9 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)", org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java index 810323a4cf3..3601fd0edcf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java @@ -1,124 +1,126 @@ -/*****************************************************************************
- * Copyright (c) 2012, 2014 CEA LIST and others.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/** An editor to be used in multitabs editor. This editor extends the original UML Diagram. */
-public class UmlTimingDiagramForMultiEditor extends org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditor {
-
- /** The location of diagram icon in the plug-in */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Timing.gif"; //$NON-NLS-1$
-
- /** The image descriptor of the diagram icon */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlTimingDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public UmlTimingDiagramForMultiEditor(final ServicesRegistry servicesRegistry, final Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(final IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- final URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (final CoreException x) {
- final String title = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle;
- final String msg = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage;
- final Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(final Composite parent) {
- this.splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- this.splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.timing.EditingDomain"; //$NON-NLS-1$
- }
-}
+/***************************************************************************** + * Copyright (c) 2012, 2014 CEA LIST and others. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.timing.custom; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + +/** An editor to be used in multitabs editor. This editor extends the original UML Diagram. */ +public class UmlTimingDiagramForMultiEditor extends org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditor { + + /** The location of diagram icon in the plug-in */ + private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Timing.gif"; //$NON-NLS-1$ + + /** The image descriptor of the diagram icon */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlTimingDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the ServiceRegistry. + * + * @throws BackboneException + * @throws ServiceException + * + */ + public UmlTimingDiagramForMultiEditor(final ServicesRegistry servicesRegistry, final Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + } + + /** + * {@inheritDoc} + */ + @Override + public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { + super.init(site, input); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setInput(final IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + final URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (final CoreException x) { + final String title = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle; + final String msg = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage; + final Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void createGraphicalViewer(final Composite parent) { + this.splitter = parent; + super.createGraphicalViewer(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + this.splitter.setFocus(); + super.setFocus(); + } + + /** + * {@inheritDoc} + */ + @Override + public String getEditingDomainID() { + return "org.eclipse.papyrus.uml.diagram.timing.EditingDomain"; //$NON-NLS-1$ + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java index 4ed297f6cd7..3a30b8649e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java @@ -1,107 +1,117 @@ -/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-/**
- * Used to get and set the name of an OccurrenceSpecification. An OccurrenceSpecification has a default name that
- * indicates what state transition it represents (when the OccurrenceSpecification is a state change). Changing the name
- * of such an OccurrenceSpecification removes the "autogenerated name" EAnnotation.
- */
-public class OccurrenceSpecificationNameParser implements IParser {
-
- @Override
- public String getEditString(final IAdaptable adaptable, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null) {
- return ""; //$NON-NLS-1$
- }
- return nonNullString(occurrenceSpecification.getName());
- }
-
- @Override
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- @Override
- public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return new AbstractTransactionalCommand(editingDomain, Messages.OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- occurrenceSpecification.setName(newString);
- OccurrenceSpecificationUtils.setAutogeneratedName(occurrenceSpecification, false);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- @Override
- public String getPrintString(final IAdaptable adaptable, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
- // don't display the auto-generated name (pollutes the view without any benefit)
- return ""; //$NON-NLS-1$
- }
- return occurrenceSpecification.getName();
- }
-
- @Override
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- @Override
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-
- private static OccurrenceSpecification getOccurrenceSpecification(final IAdaptable adaptable) {
- final Object adapter = adaptable.getAdapter(EObject.class);
- if (adapter instanceof OccurrenceSpecification) {
- return (OccurrenceSpecification) adapter;
- }
- return null;
- }
-
- private static String nonNullString(final String string) {
- if (string == null) {
- return ""; //$NON-NLS-1$
- }
- return string;
- }
-}
+/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.Fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.timing.custom.parsers; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.diagram.timing.custom.Messages; +import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.OccurrenceSpecification; + +/** + * Used to get and set the name of an OccurrenceSpecification. An OccurrenceSpecification has a default name that + * indicates what state transition it represents (when the OccurrenceSpecification is a state change). Changing the name + * of such an OccurrenceSpecification removes the "autogenerated name" EAnnotation. + */ +public class OccurrenceSpecificationNameParser implements IParser { + + @Override + public String getEditString(final IAdaptable adaptable, final int flags) { + final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable); + if (occurrenceSpecification == null) { + return ""; //$NON-NLS-1$ + } + return nonNullString(UMLLabelInternationalization.getInstance().getLabel(occurrenceSpecification)); + } + + @Override + public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) { + return ParserEditStatus.EDITABLE_STATUS; + } + + @Override + public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) { + final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable); + if (occurrenceSpecification == null) { + return UnexecutableCommand.INSTANCE; + } + final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + return new AbstractTransactionalCommand(editingDomain, Messages.OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName, null) { + + @Override + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(occurrenceSpecification) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(occurrenceSpecification)) { + UMLLabelInternationalization.getInstance().setLabel(occurrenceSpecification, newString, null); + }else{ + occurrenceSpecification.setName(newString); + } + OccurrenceSpecificationUtils.setAutogeneratedName(occurrenceSpecification, false); + return CommandResult.newOKCommandResult(); + } + }; + } + + @Override + public String getPrintString(final IAdaptable adaptable, final int flags) { + final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable); + if (occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) { + // don't display the auto-generated name (pollutes the view without any benefit) + return ""; //$NON-NLS-1$ + } + return UMLLabelInternationalization.getInstance().getLabel(occurrenceSpecification); + } + + @Override + public boolean isAffectingEvent(final Object event, final int flags) { + return true; + } + + @Override + public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) { + return null; + } + + private static OccurrenceSpecification getOccurrenceSpecification(final IAdaptable adaptable) { + final Object adapter = adaptable.getAdapter(EObject.class); + if (adapter instanceof OccurrenceSpecification) { + return (OccurrenceSpecification) adapter; + } + return null; + } + + private static String nonNullString(final String string) { + if (string == null) { + return ""; //$NON-NLS-1$ + } + return string; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java index 8ef533f7a02..a6ec724e43b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java @@ -1,93 +1,102 @@ -/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.StateInvariant;
-
-/** Used to get and set the name of a StateDefinition when editing a StateDefinition's label */
-public class StateDefinitionParser implements IParser {
-
- public static final String DEFAULT_EDIT_VALUE = ""; //$NON-NLS
-
- @Override
- public String getEditString(final IAdaptable adaptable, final int flags) {
- StateInvariant stateInvariant = (StateInvariant) adaptable.getAdapter(EObject.class);
- return stateInvariant != null ? stateInvariant.getName() : DEFAULT_EDIT_VALUE;
- }
-
- @Override
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- @Override
- public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
- final View lifelineView = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineEditPartCN.VISUAL_ID);
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- return new AbstractTransactionalCommand(editingDomain, Messages.StateDefinitionParser_SetStateDefinitionName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, newString);
- LifelineUtils.updateFragmentNames(lifeline, lifelineView);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- @Override
- public String getPrintString(final IAdaptable adaptable, final int flags) {
- StateInvariant stateInvariant = (StateInvariant) adaptable.getAdapter(EObject.class);
- String name = stateInvariant != null ? stateInvariant.getName() : null;
- if (name == null || name.length() == 0) {
- return Messages.StateDefinitionParser_Unnamed;
- }
- return name;
- }
-
- @Override
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- @Override
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.Fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.timing.custom.parsers; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.papyrus.uml.diagram.timing.custom.Messages; +import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils; +import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils; +import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils; +import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.StateInvariant; + +/** Used to get and set the name of a StateDefinition when editing a StateDefinition's label */ +public class StateDefinitionParser implements IParser { + + public static final String DEFAULT_EDIT_VALUE = ""; // $NON-NLS + + @Override + public String getEditString(final IAdaptable adaptable, final int flags) { + StateInvariant stateInvariant = (StateInvariant) adaptable.getAdapter(EObject.class); + return stateInvariant != null ? UMLLabelInternationalization.getInstance().getLabel(stateInvariant) : DEFAULT_EDIT_VALUE; + } + + @Override + public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) { + return ParserEditStatus.EDITABLE_STATUS; + } + + @Override + public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) { + final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class); + final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer(); + final View lifelineView = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineEditPartCN.VISUAL_ID); + final Lifeline lifeline = (Lifeline) lifelineView.getElement(); + final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline); + if (editingDomain == null) { + return UnexecutableCommand.INSTANCE; + } + + return new AbstractTransactionalCommand(editingDomain, Messages.StateDefinitionParser_SetStateDefinitionName, null) { + + @Override + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { + + // TODO : A bug exist for the label state definition modification + // The label modification for the state definition must be managed by the StateDefinitionUtils + + StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, newString); + LifelineUtils.updateFragmentNames(lifeline, lifelineView); + return CommandResult.newOKCommandResult(); + } + }; + } + + @Override + public String getPrintString(final IAdaptable adaptable, final int flags) { + StateInvariant stateInvariant = (StateInvariant) adaptable.getAdapter(EObject.class); + String name = stateInvariant != null ? UMLLabelInternationalization.getInstance().getLabel(stateInvariant) : null; + if (name == null || name.length() == 0) { + return Messages.StateDefinitionParser_Unnamed; + } + return name; + } + + @Override + public boolean isAffectingEvent(final Object event, final int flags) { + return true; + } + + @Override + public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) { + return null; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java index c9807e2fba4..a727dc5597e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.Fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.timing.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.timing.part.Messages; import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -208,4 +216,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF index f2fb53fffea..36962d39365 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF @@ -38,7 +38,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version= org.eclipse.draw2d;bundle-version="[3.10.0,4.0.0)";visibility:=reexport, org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Eclipse-LazyStart: true Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UmlUseCaseDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UmlUseCaseDiagramForMultiEditor.java index 0f4c2a7fafd..63ffb310e57 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UmlUseCaseDiagramForMultiEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UmlUseCaseDiagramForMultiEditor.java @@ -1,134 +1,136 @@ -/*****************************************************************************
- * Copyright (c) 2008, 2014 Atos Origin, CEA, and others.
- *
- *
- * 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:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.usecase;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Editor used in multitabs editor.
- *
- * @author Emilien Perico
- *
- */
-public class UmlUseCaseDiagramForMultiEditor extends UMLDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_UseCase.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlUseCaseDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- private Image titleImage;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public UmlUseCaseDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- titleImage = DIAG_IMG_DESC.createImage();
- setTitleImage(titleImage);
- }
-
- @Override
- public void dispose() {
- if (titleImage != null) {
- titleImage.dispose();
- titleImage = null;
- }
-
- super.dispose();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.usecase.EditingDomain";
- }
-}
+/***************************************************************************** + * Copyright (c) 2008, 2014 Atos Origin, CEA, and others. + * + * + * 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: + * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.usecase; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; +import org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditor; +import org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + +/** + * Editor used in multitabs editor. + * + * @author Emilien Perico + * + */ +public class UmlUseCaseDiagramForMultiEditor extends UMLDiagramEditor { + + /** + * The location of diagram icon in the plug-in + */ + private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_UseCase.gif"; + + /** + * The image descriptor of the diagram icon + */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlUseCaseDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + private Image titleImage; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the + * ServiceRegistry. + * + * @throws BackboneException + * @throws ServiceException + * + */ + public UmlUseCaseDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { + super(servicesRegistry, diagram); + } + + /** + * {@inheritDoc} + */ + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + setPartName(LabelInternationalization.getInstance().getDiagramLabel(getDiagram())); + titleImage = DIAG_IMG_DESC.createImage(); + setTitleImage(titleImage); + } + + @Override + public void dispose() { + if (titleImage != null) { + titleImage.dispose(); + titleImage = null; + } + + super.dispose(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setInput(IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; + String msg = "Cannot open input element:"; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + + /** + * {@inheritDoc} + */ + @Override + public String getEditingDomainID() { + return "org.eclipse.papyrus.uml.diagram.usecase.EditingDomain"; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/helper/ExtensionPointLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/helper/ExtensionPointLabelHelper.java index a44bc7d8708..5f6ddee2403 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/helper/ExtensionPointLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/helper/ExtensionPointLabelHelper.java @@ -9,6 +9,7 @@ * * Contributors: * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.Fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.usecase.helper; @@ -20,6 +21,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Image; import org.eclipse.uml2.uml.NamedElement; @@ -87,7 +89,7 @@ public class ExtensionPointLabelHelper extends StereotypedElementLabelHelper { protected String elementLabel(GraphicalEditPart editPart) { NamedElement element = getUMLElement(editPart); if (element != null) { - return getUMLElement(editPart).getName(); + return UMLLabelInternationalization.getInstance().getLabel(getUMLElement(editPart)); } return null; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/parsers/MessageFormatParser.java index 79d0a55f756..18f8df91d96 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/parsers/MessageFormatParser.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.Fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.usecase.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.usecase.part.Messages; import org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -208,4 +216,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } diff --git a/plugins/uml/internationalization/.project b/plugins/uml/internationalization/.project new file mode 100644 index 00000000000..24ff6b9478e --- /dev/null +++ b/plugins/uml/internationalization/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>uml_internationalization</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.classpath b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.classpath new file mode 100644 index 00000000000..4221242104f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.project b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.project new file mode 100644 index 00000000000..8c098aba9de --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.project @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.internationalization.edit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.oomph.version.VersionBuilder</name> + <arguments> + <dictionary> + <key>check.maven.pom</key> + <value>true</value> + </dictionary> + <dictionary> + <key>ignore.lower.bound.dependency.ranges</key> + <value>true</value> + </dictionary> + <dictionary> + <key>release.path</key> + <value>/org.eclipse.papyrus.releng.main.release/release.xml</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.oomph.version.VersionNature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/.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.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/META-INF/MANIFEST.MF b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..28d74f78f73 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.uml.internationalization.edit;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)", + org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)", + org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)" +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.papyrus.uml.internationalization.edit.Activator +Export-Package: org.eclipse.papyrus.uml.internationalization.edit, + org.eclipse.papyrus.uml.internationalization.edit.providers, + org.eclipse.papyrus.uml.internationalization.edit.utils diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/about.html b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/about.html new file mode 100644 index 00000000000..598b3684879 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 12, 2008</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/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/build.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/build.properties new file mode 100644 index 00000000000..2964bc2d7b1 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/build.properties @@ -0,0 +1,11 @@ +# + +bin.includes = .,\ + META-INF/,\ + about.html,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.properties new file mode 100644 index 00000000000..32161262f47 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = Papyrus Internationalization Edit Support for UML +providerName = Eclipse Modeling Project diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.xml new file mode 100644 index 00000000000..773b179da5f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/plugin.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- +--> + +<plugin> + + <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories"> + <factory + uri = "http://www.eclipse.org/uml2/5.0.0/UML" + class = "org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory" + supportedTypes = + "org.eclipse.emf.edit.provider.IEditingDomainItemProvider + org.eclipse.emf.edit.provider.IStructuredItemContentProvider + org.eclipse.emf.edit.provider.ITreeItemContentProvider + org.eclipse.emf.edit.provider.IItemLabelProvider + org.eclipse.emf.edit.provider.IItemColorProvider + org.eclipse.emf.edit.provider.IItemFontProvider + org.eclipse.emf.edit.provider.IItemPropertySource" /> + </extension> +</plugin> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/pom.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/pom.xml new file mode 100644 index 00000000000..d517bd33c9b --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml-internationalization</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.internationalization.edit</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/Activator.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/Activator.java new file mode 100644 index 00000000000..37e4d945384 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/Activator.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.edit; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.internationalization.edit"; //$NON-NLS-1$ + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The log helper. + */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final 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/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/providers/InternationalizationUMLItemProviderAdapterFactory.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/providers/InternationalizationUMLItemProviderAdapterFactory.java new file mode 100644 index 00000000000..e16a9de9a4c --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/providers/InternationalizationUMLItemProviderAdapterFactory.java @@ -0,0 +1,3492 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.edit.providers; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.papyrus.uml.internationalization.edit.utils.InternationalizationElementItemProviderUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.common.util.UML2Util; +import org.eclipse.uml2.uml.LiteralUnlimitedNatural; +import org.eclipse.uml2.uml.MultiplicityElement; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.edit.providers.*; +import org.eclipse.uml2.uml.util.UMLUtil; + +/** + * This allows to override the {@link UMLItemProviderAdapterFactory} to avoid + * the {@link NamedElement#getLabel()} call when the internationalization + * preference is set to false. + */ +public class InternationalizationUMLItemProviderAdapterFactory extends UMLItemProviderAdapterFactory { + + /** + * Constructor. + */ + public InternationalizationUMLItemProviderAdapterFactory() { + super(); + } + + @Override + public Adapter createDependencyAdapter() { + if (dependencyItemProvider == null) { + dependencyItemProvider = new DependencyItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return dependencyItemProvider; + } + + @Override + public Adapter createPackageAdapter() { + if (packageItemProvider == null) { + packageItemProvider = new PackageItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return packageItemProvider; + } + + @Override + public Adapter createProfileAdapter() { + if (profileItemProvider == null) { + profileItemProvider = new ProfileItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return profileItemProvider; + } + + @Override + public Adapter createStereotypeAdapter() { + if (stereotypeItemProvider == null) { + stereotypeItemProvider = new StereotypeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return stereotypeItemProvider; + } + + @Override + public Adapter createClassAdapter() { + if (classItemProvider == null) { + classItemProvider = new ClassItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return classItemProvider; + } + + @Override + public Adapter createGeneralizationSetAdapter() { + if (generalizationSetItemProvider == null) { + generalizationSetItemProvider = new GeneralizationSetItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return generalizationSetItemProvider; + } + + @Override + public Adapter createUseCaseAdapter() { + if (useCaseItemProvider == null) { + useCaseItemProvider = new UseCaseItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return useCaseItemProvider; + } + + @Override + public Adapter createIncludeAdapter() { + if (includeItemProvider == null) { + includeItemProvider = new IncludeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return includeItemProvider; + } + + @Override + public Adapter createExtendAdapter() { + if (extendItemProvider == null) { + extendItemProvider = new ExtendItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return extendItemProvider; + } + + @Override + public Adapter createConstraintAdapter() { + if (constraintItemProvider == null) { + constraintItemProvider = new ConstraintItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return constraintItemProvider; + } + + @Override + public Adapter createExtensionPointAdapter() { + if (extensionPointItemProvider == null) { + extensionPointItemProvider = new ExtensionPointItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return extensionPointItemProvider; + } + + @Override + public Adapter createSubstitutionAdapter() { + if (substitutionItemProvider == null) { + substitutionItemProvider = new SubstitutionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return substitutionItemProvider; + } + + @Override + public Adapter createRealizationAdapter() { + if (realizationItemProvider == null) { + realizationItemProvider = new RealizationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return realizationItemProvider; + } + + @Override + public Adapter createAbstractionAdapter() { + if (abstractionItemProvider == null) { + abstractionItemProvider = new AbstractionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return abstractionItemProvider; + } + + @Override + public Adapter createOpaqueExpressionAdapter() { + if (opaqueExpressionItemProvider == null) { + opaqueExpressionItemProvider = new OpaqueExpressionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return opaqueExpressionItemProvider; + } + + @Override + public Adapter createParameterAdapter() { + if (parameterItemProvider == null) { + parameterItemProvider = new ParameterItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return parameterItemProvider; + } + + @Override + public Adapter createPropertyAdapter() { + if (propertyItemProvider == null) { + propertyItemProvider = new PropertyItemProvider(this) { + + public String getText(Object object) { + StringBuffer text = appendType( + appendKeywords(new StringBuffer(), object), "_UI_Property_type"); //$NON-NLS-1$ + + final Property property = (Property) object; + final Type type = property.getType(); + + if (property.isDerived()) { + appendString(text, "/"); //$NON-NLS-1$ + } + + String label = UMLLabelInternationalization.getInstance().getLabel(property, shouldTranslate()); + + if (!UML2Util.isEmpty(label)) { + appendString(text, label); + } else if (property.getAssociation() != null && type != null) { + String typeName = type.getName(); + + if (!UML2Util.isEmpty(typeName)) { + appendString(text, Character.toLowerCase(typeName.charAt(0)) + + typeName.substring(1)); + } + } + + if (type != null) { + String typeLabel = UMLLabelInternationalization.getInstance().getLabel(type, shouldTranslate()); + + if (!UMLUtil.isEmpty(typeLabel)) { + appendString(text, ": " + typeLabel); //$NON-NLS-1$ + } + } + + return ExtendedMultiplicityElementItemProvider.appendMultiplicityString(text, object) + .toString(); + } + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return propertyItemProvider; + } + + /** + * This allows to redefine the 'appendMultiplicity' method. + */ + public static class ExtendedMultiplicityElementItemProvider extends MultiplicityElementItemProvider{ + + /** + * Constructor. + * + * @param adapterFactory The adapter factory + */ + public ExtendedMultiplicityElementItemProvider(final AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This allows to append the multiplicity. + * + * @param text The existing string buffer. + * @param object The multiplicity element. + * @return The existing string buffer concat with multiplicity. + */ + public static StringBuffer appendMultiplicityString(final StringBuffer text, final Object object) { + return MultiplicityElementItemProvider.appendMultiplicity(text, object); + } + } + + @Override + public Adapter createDeploymentAdapter() { + if (deploymentItemProvider == null) { + deploymentItemProvider = new DeploymentItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return deploymentItemProvider; + } + + @Override + public Adapter createDeploymentSpecificationAdapter() { + if (deploymentSpecificationItemProvider == null) { + deploymentSpecificationItemProvider = new DeploymentSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return deploymentSpecificationItemProvider; + } + + @Override + public Adapter createArtifactAdapter() { + if (artifactItemProvider == null) { + artifactItemProvider = new ArtifactItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return artifactItemProvider; + } + + @Override + public Adapter createManifestationAdapter() { + if (manifestationItemProvider == null) { + manifestationItemProvider = new ManifestationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return manifestationItemProvider; + } + + @Override + public Adapter createOperationAdapter() { + if (operationItemProvider == null) { + operationItemProvider = new OperationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + + @Override + public String getText(Object object) { + final StringBuffer text = appendLabel( + appendType(appendKeywords(new StringBuffer(), object), "_UI_Operation_type"), object); //$NON-NLS-1$ + + final Operation operation = (Operation) object; + + appendString(text, "("); + + final List<Parameter> ownedParameters = new ArrayList<Parameter>(operation.getOwnedParameters()); + ownedParameters.removeAll(operation.returnResult()); + + for (Iterator<Parameter> parameters = ownedParameters.iterator(); parameters.hasNext();) { + + final Parameter parameter = parameters.next(); + final String label = UMLLabelInternationalization.getInstance().getLabel(parameter, + shouldTranslate()); + if (UMLUtil.isEmpty(label)) { + text.append('<').append(getTypeText(parameter)).append('>'); + } else { + text.append(label); + } + + final Type type = parameter.getType(); + + if (null != type) { + final String typeLabel = UMLLabelInternationalization.getInstance().getLabel(type, + shouldTranslate()); + + if (!UMLUtil.isEmpty(typeLabel)) { + appendString(text, ": " + typeLabel); //$NON-NLS-1$ + } + } + + appendMultiplicity(text, parameter); + + if (parameters.hasNext()) { + text.append(", "); //$NON-NLS-1$ + } + } + + text.append(')'); + + Parameter returnResult = operation.getReturnResult(); + + if (returnResult != null) { + Type type = returnResult.getType(); + + if (type != null) { + String typeLabel = type.getLabel(shouldTranslate()); + + if (!UMLUtil.isEmpty(typeLabel)) { + appendString(text, ": " + typeLabel); //$NON-NLS-1$ + } + } + + appendMultiplicity(text, returnResult); + } + + return text.toString(); + } + }; + } + return operationItemProvider; + } + + @Override + public Adapter createParameterSetAdapter() { + if (parameterSetItemProvider == null) { + parameterSetItemProvider = new ParameterSetItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return parameterSetItemProvider; + } + + @Override + public Adapter createDataTypeAdapter() { + if (dataTypeItemProvider == null) { + dataTypeItemProvider = new DataTypeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return dataTypeItemProvider; + } + + @Override + public Adapter createInterfaceAdapter() { + if (interfaceItemProvider == null) { + interfaceItemProvider = new InterfaceItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interfaceItemProvider; + } + + @Override + public Adapter createReceptionAdapter() { + if (receptionItemProvider == null) { + receptionItemProvider = new ReceptionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return receptionItemProvider; + } + + @Override + public Adapter createSignalAdapter() { + if (signalItemProvider == null) { + signalItemProvider = new SignalItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return signalItemProvider; + } + + @Override + public Adapter createProtocolStateMachineAdapter() { + if (protocolStateMachineItemProvider == null) { + protocolStateMachineItemProvider = new ProtocolStateMachineItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return protocolStateMachineItemProvider; + } + + @Override + public Adapter createStateMachineAdapter() { + if (stateMachineItemProvider == null) { + stateMachineItemProvider = new StateMachineItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return stateMachineItemProvider; + } + + @Override + public Adapter createRegionAdapter() { + if (regionItemProvider == null) { + regionItemProvider = new RegionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return regionItemProvider; + } + + @Override + public Adapter createTransitionAdapter() { + if (transitionItemProvider == null) { + transitionItemProvider = new TransitionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return transitionItemProvider; + } + + @Override + public Adapter createTriggerAdapter() { + if (triggerItemProvider == null) { + triggerItemProvider = new TriggerItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return triggerItemProvider; + } + + @Override + public Adapter createPortAdapter() { + if (portItemProvider == null) { + portItemProvider = new PortItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return portItemProvider; + } + + @Override + public Adapter createStateAdapter() { + if (stateItemProvider == null) { + stateItemProvider = new StateItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return stateItemProvider; + } + + @Override + public Adapter createConnectionPointReferenceAdapter() { + if (connectionPointReferenceItemProvider == null) { + connectionPointReferenceItemProvider = new ConnectionPointReferenceItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return connectionPointReferenceItemProvider; + } + + @Override + public Adapter createPseudostateAdapter() { + if (pseudostateItemProvider == null) { + pseudostateItemProvider = new PseudostateItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return pseudostateItemProvider; + } + + @Override + public Adapter createAssociationAdapter() { + if (associationItemProvider == null) { + associationItemProvider = new AssociationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return associationItemProvider; + } + + @Override + public Adapter createCollaborationUseAdapter() { + if (collaborationUseItemProvider == null) { + collaborationUseItemProvider = new CollaborationUseItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return collaborationUseItemProvider; + } + + @Override + public Adapter createCollaborationAdapter() { + if (collaborationItemProvider == null) { + collaborationItemProvider = new CollaborationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return collaborationItemProvider; + } + + @Override + public Adapter createConnectorAdapter() { + if (connectorItemProvider == null) { + connectorItemProvider = new ConnectorItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return connectorItemProvider; + } + + @Override + public Adapter createRedefinableTemplateSignatureAdapter() { + if (redefinableTemplateSignatureItemProvider == null) { + redefinableTemplateSignatureItemProvider = new RedefinableTemplateSignatureItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return redefinableTemplateSignatureItemProvider; + } + + @Override + public Adapter createInterfaceRealizationAdapter() { + if (interfaceRealizationItemProvider == null) { + interfaceRealizationItemProvider = new InterfaceRealizationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interfaceRealizationItemProvider; + } + + @Override + public Adapter createExtensionAdapter() { + if (extensionItemProvider == null) { + extensionItemProvider = new ExtensionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return extensionItemProvider; + } + + @Override + public Adapter createExtensionEndAdapter() { + if (extensionEndItemProvider == null) { + extensionEndItemProvider = new ExtensionEndItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return extensionEndItemProvider; + } + + @Override + public Adapter createStringExpressionAdapter() { + if (stringExpressionItemProvider == null) { + stringExpressionItemProvider = new StringExpressionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return stringExpressionItemProvider; + } + + @Override + public Adapter createExpressionAdapter() { + if (expressionItemProvider == null) { + expressionItemProvider = new ExpressionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return expressionItemProvider; + } + + @Override + public Adapter createLiteralIntegerAdapter() { + if (literalIntegerItemProvider == null) { + literalIntegerItemProvider = new LiteralIntegerItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return literalIntegerItemProvider; + } + + @Override + public Adapter createLiteralStringAdapter() { + if (literalStringItemProvider == null) { + literalStringItemProvider = new LiteralStringItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return literalStringItemProvider; + } + + @Override + public Adapter createLiteralBooleanAdapter() { + if (literalBooleanItemProvider == null) { + literalBooleanItemProvider = new LiteralBooleanItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return literalBooleanItemProvider; + } + + @Override + public Adapter createLiteralNullAdapter() { + if (literalNullItemProvider == null) { + literalNullItemProvider = new LiteralNullItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return literalNullItemProvider; + } + + @Override + public Adapter createInstanceSpecificationAdapter() { + if (instanceSpecificationItemProvider == null) { + instanceSpecificationItemProvider = new InstanceSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return instanceSpecificationItemProvider; + } + + @Override + public Adapter createEnumerationAdapter() { + if (enumerationItemProvider == null) { + enumerationItemProvider = new EnumerationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return enumerationItemProvider; + } + + @Override + public Adapter createEnumerationLiteralAdapter() { + if (enumerationLiteralItemProvider == null) { + enumerationLiteralItemProvider = new EnumerationLiteralItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return enumerationLiteralItemProvider; + } + + @Override + public Adapter createPrimitiveTypeAdapter() { + if (primitiveTypeItemProvider == null) { + primitiveTypeItemProvider = new PrimitiveTypeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return primitiveTypeItemProvider; + } + + @Override + public Adapter createInstanceValueAdapter() { + if (instanceValueItemProvider == null) { + instanceValueItemProvider = new InstanceValueItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return instanceValueItemProvider; + } + + @Override + public Adapter createLiteralUnlimitedNaturalAdapter() { + if (literalUnlimitedNaturalItemProvider == null) { + literalUnlimitedNaturalItemProvider = new LiteralUnlimitedNaturalItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return literalUnlimitedNaturalItemProvider; + } + + @Override + public Adapter createOpaqueBehaviorAdapter() { + if (opaqueBehaviorItemProvider == null) { + opaqueBehaviorItemProvider = new OpaqueBehaviorItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return opaqueBehaviorItemProvider; + } + + @Override + public Adapter createFunctionBehaviorAdapter() { + if (functionBehaviorItemProvider == null) { + functionBehaviorItemProvider = new FunctionBehaviorItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return functionBehaviorItemProvider; + } + + @Override + public Adapter createActorAdapter() { + if (actorItemProvider == null) { + actorItemProvider = new ActorItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return actorItemProvider; + } + + @Override + public Adapter createUsageAdapter() { + if (usageItemProvider == null) { + usageItemProvider = new UsageItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return usageItemProvider; + } + + @Override + public Adapter createMessageAdapter() { + if (messageItemProvider == null) { + messageItemProvider = new MessageItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return messageItemProvider; + } + + @Override + public Adapter createInteractionAdapter() { + if (interactionItemProvider == null) { + interactionItemProvider = new InteractionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interactionItemProvider; + } + + @Override + public Adapter createLifelineAdapter() { + if (lifelineItemProvider == null) { + lifelineItemProvider = new LifelineItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return lifelineItemProvider; + } + + @Override + public Adapter createPartDecompositionAdapter() { + if (partDecompositionItemProvider == null) { + partDecompositionItemProvider = new PartDecompositionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return partDecompositionItemProvider; + } + + @Override + public Adapter createInteractionUseAdapter() { + if (interactionUseItemProvider == null) { + interactionUseItemProvider = new InteractionUseItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interactionUseItemProvider; + } + + @Override + public Adapter createGateAdapter() { + if (gateItemProvider == null) { + gateItemProvider = new GateItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return gateItemProvider; + } + + @Override + public Adapter createActivityAdapter() { + if (activityItemProvider == null) { + activityItemProvider = new ActivityItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return activityItemProvider; + } + + @Override + public Adapter createActivityPartitionAdapter() { + if (activityPartitionItemProvider == null) { + activityPartitionItemProvider = new ActivityPartitionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return activityPartitionItemProvider; + } + + @Override + public Adapter createStructuredActivityNodeAdapter() { + if (structuredActivityNodeItemProvider == null) { + structuredActivityNodeItemProvider = new StructuredActivityNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return structuredActivityNodeItemProvider; + } + + @Override + public Adapter createVariableAdapter() { + if (variableItemProvider == null) { + variableItemProvider = new VariableItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return variableItemProvider; + } + + @Override + public Adapter createInterruptibleActivityRegionAdapter() { + if (interruptibleActivityRegionItemProvider == null) { + interruptibleActivityRegionItemProvider = new InterruptibleActivityRegionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interruptibleActivityRegionItemProvider; + } + + @Override + public Adapter createExceptionHandlerAdapter() { + if (exceptionHandlerItemProvider == null) { + exceptionHandlerItemProvider = new ExceptionHandlerItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return exceptionHandlerItemProvider; + } + + @Override + public Adapter createOutputPinAdapter() { + if (outputPinItemProvider == null) { + outputPinItemProvider = new OutputPinItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return outputPinItemProvider; + } + + @Override + public Adapter createInputPinAdapter() { + if (inputPinItemProvider == null) { + inputPinItemProvider = new InputPinItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return inputPinItemProvider; + } + + @Override + public Adapter createGeneralOrderingAdapter() { + if (generalOrderingItemProvider == null) { + generalOrderingItemProvider = new GeneralOrderingItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return generalOrderingItemProvider; + } + + @Override + public Adapter createOccurrenceSpecificationAdapter() { + if (occurrenceSpecificationItemProvider == null) { + occurrenceSpecificationItemProvider = new OccurrenceSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return occurrenceSpecificationItemProvider; + } + + @Override + public Adapter createInteractionOperandAdapter() { + if (interactionOperandItemProvider == null) { + interactionOperandItemProvider = new InteractionOperandItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interactionOperandItemProvider; + } + + @Override + public Adapter createInteractionConstraintAdapter() { + if (interactionConstraintItemProvider == null) { + interactionConstraintItemProvider = new InteractionConstraintItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return interactionConstraintItemProvider; + } + + @Override + public Adapter createExecutionOccurrenceSpecificationAdapter() { + if (executionOccurrenceSpecificationItemProvider == null) { + executionOccurrenceSpecificationItemProvider = new ExecutionOccurrenceSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return executionOccurrenceSpecificationItemProvider; + } + + @Override + public Adapter createStateInvariantAdapter() { + if (stateInvariantItemProvider == null) { + stateInvariantItemProvider = new StateInvariantItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return stateInvariantItemProvider; + } + + @Override + public Adapter createActionExecutionSpecificationAdapter() { + if (actionExecutionSpecificationItemProvider == null) { + actionExecutionSpecificationItemProvider = new ActionExecutionSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return actionExecutionSpecificationItemProvider; + } + + @Override + public Adapter createBehaviorExecutionSpecificationAdapter() { + if (behaviorExecutionSpecificationItemProvider == null) { + behaviorExecutionSpecificationItemProvider = new BehaviorExecutionSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return behaviorExecutionSpecificationItemProvider; + } + + @Override + public Adapter createMessageOccurrenceSpecificationAdapter() { + if (messageOccurrenceSpecificationItemProvider == null) { + messageOccurrenceSpecificationItemProvider = new MessageOccurrenceSpecificationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return messageOccurrenceSpecificationItemProvider; + } + + @Override + public Adapter createCombinedFragmentAdapter() { + if (combinedFragmentItemProvider == null) { + combinedFragmentItemProvider = new CombinedFragmentItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return combinedFragmentItemProvider; + } + + @Override + public Adapter createContinuationAdapter() { + if (continuationItemProvider == null) { + continuationItemProvider = new ContinuationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return continuationItemProvider; + } + + @Override + public Adapter createConsiderIgnoreFragmentAdapter() { + if (considerIgnoreFragmentItemProvider == null) { + considerIgnoreFragmentItemProvider = new ConsiderIgnoreFragmentItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return considerIgnoreFragmentItemProvider; + } + + @Override + public Adapter createCallEventAdapter() { + if (callEventItemProvider == null) { + callEventItemProvider = new CallEventItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return callEventItemProvider; + } + + @Override + public Adapter createChangeEventAdapter() { + if (changeEventItemProvider == null) { + changeEventItemProvider = new ChangeEventItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return changeEventItemProvider; + } + + @Override + public Adapter createSignalEventAdapter() { + if (signalEventItemProvider == null) { + signalEventItemProvider = new SignalEventItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return signalEventItemProvider; + } + + @Override + public Adapter createAnyReceiveEventAdapter() { + if (anyReceiveEventItemProvider == null) { + anyReceiveEventItemProvider = new AnyReceiveEventItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return anyReceiveEventItemProvider; + } + + @Override + public Adapter createCreateObjectActionAdapter() { + if (createObjectActionItemProvider == null) { + createObjectActionItemProvider = new CreateObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return createObjectActionItemProvider; + } + + @Override + public Adapter createDestroyObjectActionAdapter() { + if (destroyObjectActionItemProvider == null) { + destroyObjectActionItemProvider = new DestroyObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return destroyObjectActionItemProvider; + } + + @Override + public Adapter createTestIdentityActionAdapter() { + if (testIdentityActionItemProvider == null) { + testIdentityActionItemProvider = new TestIdentityActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return testIdentityActionItemProvider; + } + + @Override + public Adapter createReadSelfActionAdapter() { + if (readSelfActionItemProvider == null) { + readSelfActionItemProvider = new ReadSelfActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readSelfActionItemProvider; + } + + @Override + public Adapter createReadStructuralFeatureActionAdapter() { + if (readStructuralFeatureActionItemProvider == null) { + readStructuralFeatureActionItemProvider = new ReadStructuralFeatureActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readStructuralFeatureActionItemProvider; + } + + @Override + public Adapter createClearStructuralFeatureActionAdapter() { + if (clearStructuralFeatureActionItemProvider == null) { + clearStructuralFeatureActionItemProvider = new ClearStructuralFeatureActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return clearStructuralFeatureActionItemProvider; + } + + @Override + public Adapter createRemoveStructuralFeatureValueActionAdapter() { + if (removeStructuralFeatureValueActionItemProvider == null) { + removeStructuralFeatureValueActionItemProvider = new RemoveStructuralFeatureValueActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return removeStructuralFeatureValueActionItemProvider; + } + + @Override + public Adapter createAddStructuralFeatureValueActionAdapter() { + if (addStructuralFeatureValueActionItemProvider == null) { + addStructuralFeatureValueActionItemProvider = new AddStructuralFeatureValueActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return addStructuralFeatureValueActionItemProvider; + } + + @Override + public Adapter createLinkEndDataAdapter() { + if (linkEndDataItemProvider == null) { + linkEndDataItemProvider = new LinkEndDataItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return linkEndDataItemProvider; + } + + @Override + public Adapter createQualifierValueAdapter() { + if (qualifierValueItemProvider == null) { + qualifierValueItemProvider = new QualifierValueItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return qualifierValueItemProvider; + } + + @Override + public Adapter createReadLinkActionAdapter() { + if (readLinkActionItemProvider == null) { + readLinkActionItemProvider = new ReadLinkActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readLinkActionItemProvider; + } + + @Override + public Adapter createLinkEndCreationDataAdapter() { + if (linkEndCreationDataItemProvider == null) { + linkEndCreationDataItemProvider = new LinkEndCreationDataItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return linkEndCreationDataItemProvider; + } + + @Override + public Adapter createCreateLinkActionAdapter() { + if (createLinkActionItemProvider == null) { + createLinkActionItemProvider = new CreateLinkActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return createLinkActionItemProvider; + } + + @Override + public Adapter createDestroyLinkActionAdapter() { + if (destroyLinkActionItemProvider == null) { + destroyLinkActionItemProvider = new DestroyLinkActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return destroyLinkActionItemProvider; + } + + @Override + public Adapter createLinkEndDestructionDataAdapter() { + if (linkEndDestructionDataItemProvider == null) { + linkEndDestructionDataItemProvider = new LinkEndDestructionDataItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return linkEndDestructionDataItemProvider; + } + + @Override + public Adapter createClearAssociationActionAdapter() { + if (clearAssociationActionItemProvider == null) { + clearAssociationActionItemProvider = new ClearAssociationActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return clearAssociationActionItemProvider; + } + + @Override + public Adapter createBroadcastSignalActionAdapter() { + if (broadcastSignalActionItemProvider == null) { + broadcastSignalActionItemProvider = new BroadcastSignalActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return broadcastSignalActionItemProvider; + } + + @Override + public Adapter createSendObjectActionAdapter() { + if (sendObjectActionItemProvider == null) { + sendObjectActionItemProvider = new SendObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return sendObjectActionItemProvider; + } + + @Override + public Adapter createValueSpecificationActionAdapter() { + if (valueSpecificationActionItemProvider == null) { + valueSpecificationActionItemProvider = new ValueSpecificationActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return valueSpecificationActionItemProvider; + } + + @Override + public Adapter createTimeExpressionAdapter() { + if (timeExpressionItemProvider == null) { + timeExpressionItemProvider = new TimeExpressionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return timeExpressionItemProvider; + } + + @Override + public Adapter createDurationAdapter() { + if (durationItemProvider == null) { + durationItemProvider = new DurationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return durationItemProvider; + } + + @Override + public Adapter createValuePinAdapter() { + if (valuePinItemProvider == null) { + valuePinItemProvider = new ValuePinItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return valuePinItemProvider; + } + + @Override + public Adapter createDurationIntervalAdapter() { + if (durationIntervalItemProvider == null) { + durationIntervalItemProvider = new DurationIntervalItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return durationIntervalItemProvider; + } + + @Override + public Adapter createIntervalAdapter() { + if (intervalItemProvider == null) { + intervalItemProvider = new IntervalItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return intervalItemProvider; + } + + @Override + public Adapter createTimeConstraintAdapter() { + if (timeConstraintItemProvider == null) { + timeConstraintItemProvider = new TimeConstraintItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return timeConstraintItemProvider; + } + + @Override + public Adapter createIntervalConstraintAdapter() { + if (intervalConstraintItemProvider == null) { + intervalConstraintItemProvider = new IntervalConstraintItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return intervalConstraintItemProvider; + } + + @Override + public Adapter createTimeIntervalAdapter() { + if (timeIntervalItemProvider == null) { + timeIntervalItemProvider = new TimeIntervalItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return timeIntervalItemProvider; + } + + @Override + public Adapter createDurationConstraintAdapter() { + if (durationConstraintItemProvider == null) { + durationConstraintItemProvider = new DurationConstraintItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return durationConstraintItemProvider; + } + + @Override + public Adapter createTimeObservationAdapter() { + if (timeObservationItemProvider == null) { + timeObservationItemProvider = new TimeObservationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return timeObservationItemProvider; + } + + @Override + public Adapter createDurationObservationAdapter() { + if (durationObservationItemProvider == null) { + durationObservationItemProvider = new DurationObservationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return durationObservationItemProvider; + } + + @Override + public Adapter createOpaqueActionAdapter() { + if (opaqueActionItemProvider == null) { + opaqueActionItemProvider = new OpaqueActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return opaqueActionItemProvider; + } + + @Override + public Adapter createSendSignalActionAdapter() { + if (sendSignalActionItemProvider == null) { + sendSignalActionItemProvider = new SendSignalActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return sendSignalActionItemProvider; + } + + @Override + public Adapter createCallOperationActionAdapter() { + if (callOperationActionItemProvider == null) { + callOperationActionItemProvider = new CallOperationActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return callOperationActionItemProvider; + } + + @Override + public Adapter createCallBehaviorActionAdapter() { + if (callBehaviorActionItemProvider == null) { + callBehaviorActionItemProvider = new CallBehaviorActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return callBehaviorActionItemProvider; + } + + @Override + public Adapter createInformationItemAdapter() { + if (informationItemItemProvider == null) { + informationItemItemProvider = new InformationItemItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return informationItemItemProvider; + } + + @Override + public Adapter createInformationFlowAdapter() { + if (informationFlowItemProvider == null) { + informationFlowItemProvider = new InformationFlowItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return informationFlowItemProvider; + } + + @Override + public Adapter createModelAdapter() { + if (modelItemProvider == null) { + modelItemProvider = new ModelItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return modelItemProvider; + } + + @Override + public Adapter createReadVariableActionAdapter() { + if (readVariableActionItemProvider == null) { + readVariableActionItemProvider = new ReadVariableActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readVariableActionItemProvider; + } + + @Override + public Adapter createClearVariableActionAdapter() { + if (clearVariableActionItemProvider == null) { + clearVariableActionItemProvider = new ClearVariableActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return clearVariableActionItemProvider; + } + + @Override + public Adapter createAddVariableValueActionAdapter() { + if (addVariableValueActionItemProvider == null) { + addVariableValueActionItemProvider = new AddVariableValueActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return addVariableValueActionItemProvider; + } + + @Override + public Adapter createRemoveVariableValueActionAdapter() { + if (removeVariableValueActionItemProvider == null) { + removeVariableValueActionItemProvider = new RemoveVariableValueActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return removeVariableValueActionItemProvider; + } + + @Override + public Adapter createRaiseExceptionActionAdapter() { + if (raiseExceptionActionItemProvider == null) { + raiseExceptionActionItemProvider = new RaiseExceptionActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return raiseExceptionActionItemProvider; + } + + @Override + public Adapter createActionInputPinAdapter() { + if (actionInputPinItemProvider == null) { + actionInputPinItemProvider = new ActionInputPinItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return actionInputPinItemProvider; + } + + @Override + public Adapter createReadExtentActionAdapter() { + if (readExtentActionItemProvider == null) { + readExtentActionItemProvider = new ReadExtentActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readExtentActionItemProvider; + } + + @Override + public Adapter createReclassifyObjectActionAdapter() { + if (reclassifyObjectActionItemProvider == null) { + reclassifyObjectActionItemProvider = new ReclassifyObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return reclassifyObjectActionItemProvider; + } + + @Override + public Adapter createReadIsClassifiedObjectActionAdapter() { + if (readIsClassifiedObjectActionItemProvider == null) { + readIsClassifiedObjectActionItemProvider = new ReadIsClassifiedObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readIsClassifiedObjectActionItemProvider; + } + + @Override + public Adapter createStartClassifierBehaviorActionAdapter() { + if (startClassifierBehaviorActionItemProvider == null) { + startClassifierBehaviorActionItemProvider = new StartClassifierBehaviorActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return startClassifierBehaviorActionItemProvider; + } + + @Override + public Adapter createReadLinkObjectEndActionAdapter() { + if (readLinkObjectEndActionItemProvider == null) { + readLinkObjectEndActionItemProvider = new ReadLinkObjectEndActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readLinkObjectEndActionItemProvider; + } + + @Override + public Adapter createReadLinkObjectEndQualifierActionAdapter() { + if (readLinkObjectEndQualifierActionItemProvider == null) { + readLinkObjectEndQualifierActionItemProvider = new ReadLinkObjectEndQualifierActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return readLinkObjectEndQualifierActionItemProvider; + } + + @Override + public Adapter createCreateLinkObjectActionAdapter() { + if (createLinkObjectActionItemProvider == null) { + createLinkObjectActionItemProvider = new CreateLinkObjectActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return createLinkObjectActionItemProvider; + } + + @Override + public Adapter createAcceptEventActionAdapter() { + if (acceptEventActionItemProvider == null) { + acceptEventActionItemProvider = new AcceptEventActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return acceptEventActionItemProvider; + } + + @Override + public Adapter createAcceptCallActionAdapter() { + if (acceptCallActionItemProvider == null) { + acceptCallActionItemProvider = new AcceptCallActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return acceptCallActionItemProvider; + } + + @Override + public Adapter createReplyActionAdapter() { + if (replyActionItemProvider == null) { + replyActionItemProvider = new ReplyActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return replyActionItemProvider; + } + + @Override + public Adapter createUnmarshallActionAdapter() { + if (unmarshallActionItemProvider == null) { + unmarshallActionItemProvider = new UnmarshallActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return unmarshallActionItemProvider; + } + + @Override + public Adapter createReduceActionAdapter() { + if (reduceActionItemProvider == null) { + reduceActionItemProvider = new ReduceActionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return reduceActionItemProvider; + } + + @Override + public Adapter createControlFlowAdapter() { + if (controlFlowItemProvider == null) { + controlFlowItemProvider = new ControlFlowItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return controlFlowItemProvider; + } + + @Override + public Adapter createInitialNodeAdapter() { + if (initialNodeItemProvider == null) { + initialNodeItemProvider = new InitialNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return initialNodeItemProvider; + } + + @Override + public Adapter createActivityParameterNodeAdapter() { + if (activityParameterNodeItemProvider == null) { + activityParameterNodeItemProvider = new ActivityParameterNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return activityParameterNodeItemProvider; + } + + @Override + public Adapter createForkNodeAdapter() { + if (forkNodeItemProvider == null) { + forkNodeItemProvider = new ForkNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return forkNodeItemProvider; + } + + @Override + public Adapter createFlowFinalNodeAdapter() { + if (flowFinalNodeItemProvider == null) { + flowFinalNodeItemProvider = new FlowFinalNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return flowFinalNodeItemProvider; + } + + @Override + public Adapter createCentralBufferNodeAdapter() { + if (centralBufferNodeItemProvider == null) { + centralBufferNodeItemProvider = new CentralBufferNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return centralBufferNodeItemProvider; + } + + @Override + public Adapter createMergeNodeAdapter() { + if (mergeNodeItemProvider == null) { + mergeNodeItemProvider = new MergeNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return mergeNodeItemProvider; + } + + @Override + public Adapter createDecisionNodeAdapter() { + if (decisionNodeItemProvider == null) { + decisionNodeItemProvider = new DecisionNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return decisionNodeItemProvider; + } + + @Override + public Adapter createActivityFinalNodeAdapter() { + if (activityFinalNodeItemProvider == null) { + activityFinalNodeItemProvider = new ActivityFinalNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return activityFinalNodeItemProvider; + } + + @Override + public Adapter createJoinNodeAdapter() { + if (joinNodeItemProvider == null) { + joinNodeItemProvider = new JoinNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return joinNodeItemProvider; + } + + @Override + public Adapter createDataStoreNodeAdapter() { + if (dataStoreNodeItemProvider == null) { + dataStoreNodeItemProvider = new DataStoreNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return dataStoreNodeItemProvider; + } + + @Override + public Adapter createObjectFlowAdapter() { + if (objectFlowItemProvider == null) { + objectFlowItemProvider = new ObjectFlowItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return objectFlowItemProvider; + } + + @Override + public Adapter createSequenceNodeAdapter() { + if (sequenceNodeItemProvider == null) { + sequenceNodeItemProvider = new SequenceNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return sequenceNodeItemProvider; + } + + @Override + public Adapter createConditionalNodeAdapter() { + if (conditionalNodeItemProvider == null) { + conditionalNodeItemProvider = new ConditionalNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return conditionalNodeItemProvider; + } + + @Override + public Adapter createClauseAdapter() { + if (clauseItemProvider == null) { + clauseItemProvider = new ClauseItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return clauseItemProvider; + } + + @Override + public Adapter createLoopNodeAdapter() { + if (loopNodeItemProvider == null) { + loopNodeItemProvider = new LoopNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return loopNodeItemProvider; + } + + @Override + public Adapter createExpansionNodeAdapter() { + if (expansionNodeItemProvider == null) { + expansionNodeItemProvider = new ExpansionNodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return expansionNodeItemProvider; + } + + @Override + public Adapter createExpansionRegionAdapter() { + if (expansionRegionItemProvider == null) { + expansionRegionItemProvider = new ExpansionRegionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return expansionRegionItemProvider; + } + + @Override + public Adapter createComponentRealizationAdapter() { + if (componentRealizationItemProvider == null) { + componentRealizationItemProvider = new ComponentRealizationItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return componentRealizationItemProvider; + } + + @Override + public Adapter createComponentAdapter() { + if (componentItemProvider == null) { + componentItemProvider = new ComponentItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return componentItemProvider; + } + + @Override + public Adapter createNodeAdapter() { + if (nodeItemProvider == null) { + nodeItemProvider = new NodeItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return nodeItemProvider; + } + + @Override + public Adapter createDeviceAdapter() { + if (deviceItemProvider == null) { + deviceItemProvider = new DeviceItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return deviceItemProvider; + } + + @Override + public Adapter createExecutionEnvironmentAdapter() { + if (executionEnvironmentItemProvider == null) { + executionEnvironmentItemProvider = new ExecutionEnvironmentItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return executionEnvironmentItemProvider; + } + + @Override + public Adapter createCommunicationPathAdapter() { + if (communicationPathItemProvider == null) { + communicationPathItemProvider = new CommunicationPathItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return communicationPathItemProvider; + } + + @Override + public Adapter createFinalStateAdapter() { + if (finalStateItemProvider == null) { + finalStateItemProvider = new FinalStateItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return finalStateItemProvider; + } + + @Override + public Adapter createTimeEventAdapter() { + if (timeEventItemProvider == null) { + timeEventItemProvider = new TimeEventItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return timeEventItemProvider; + } + + @Override + public Adapter createProtocolTransitionAdapter() { + if (protocolTransitionItemProvider == null) { + protocolTransitionItemProvider = new ProtocolTransitionItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return protocolTransitionItemProvider; + } + + @Override + public Adapter createAssociationClassAdapter() { + if (associationClassItemProvider == null) { + associationClassItemProvider = new AssociationClassItemProvider(this) { + + @Override + protected StringBuffer appendLabel(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendLabel(text, object, shouldTranslate()); + } + + @Override + protected StringBuffer appendKeywords(final StringBuffer text, final Object object) { + return InternationalizationElementItemProviderUtils.appendKeywords(text, object, shouldTranslate()); + } + }; + } + return associationClassItemProvider; + } + + /** + * This is copied from MiltiplicityElementItemProvider because the initial + * function is protected scoped. + * + * @param text + * The initial string buffer. + * @param object + * The object to manage multiplicity. + * @return The modified string buffer. + */ + protected static StringBuffer appendMultiplicity(final StringBuffer text, final Object object) { + + if (object instanceof MultiplicityElement) { + MultiplicityElement multiplicityElement = (MultiplicityElement) object; + + if (multiplicityElement.eIsSet(UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER) + || multiplicityElement.eIsSet(UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER)) { + + if (0 < text.length()) { + text.append(' '); + } + + int upper = multiplicityElement.getUpper(); + + text.append('[').append(multiplicityElement.getLower()).append("..") //$NON-NLS-1$ + .append(upper == LiteralUnlimitedNatural.UNLIMITED ? "*" : String.valueOf(upper)).append(']'); //$NON-NLS-1$ + } + } + + return text; + } +} diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/utils/InternationalizationElementItemProviderUtils.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/utils/InternationalizationElementItemProviderUtils.java new file mode 100644 index 00000000000..edc9e26d7c2 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.edit/src/org/eclipse/papyrus/uml/internationalization/edit/utils/InternationalizationElementItemProviderUtils.java @@ -0,0 +1,130 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.edit.utils; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.common.util.UML2Util; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.edit.providers.ElementItemProvider; +import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; + +/** + * The appendLabel and appendKeywords inspired from {@link ElementItemProvider} + * and avoid code duplication in the inherited from + * {@link UMLItemProviderAdapterFactory}. + */ +public class InternationalizationElementItemProviderUtils { + + /** + * This allows to append the label if the internationalization preference is set to <code>true</code>. + * + * @param text The initial String buffer. + * @param object The object. + * @param souldTranslate The boolean shouldTranslate. + * @return The modified {@link StringBuffer}. + */ + public static StringBuffer appendLabel(final StringBuffer text, final Object object, final boolean souldTranslate) { + StringBuffer result = text; + if (object instanceof NamedElement) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference((NamedElement) object)) { + result = appendString(text, UMLLabelInternationalization.getInstance().getLabel((NamedElement) object, souldTranslate)); + } else { + result = appendString(text, ((NamedElement) object).getName()); + } + } + return result; + } + + /** + * This allows to append a string to the current {@link StringBuffer}. + * + * @param text The initial {@link StringBuffer}. + * @param string The string to append. + * @return The modified {@link StringBuffer}. + */ + private static StringBuffer appendString(final StringBuffer text, final String string) { + + if (!UML2Util.isEmpty(string)) { + + if (text.length() > 0) { + text.append(' '); // $NON-NLS-1$ + } + + text.append(string); + } + + return text; + } + + /** + * This allows to append the keywords if the internationalization preference is set to <code>true</code>. + * + * @param text The initial String buffer. + * @param object The object. + * @param souldTranslate The boolean shouldTranslate. + * @return The modified {@link StringBuffer}. + */ + public static StringBuffer appendKeywords(final StringBuffer text, final Object object, + final boolean shouldTranslate) { + if (object instanceof Element) { + final Element element = (Element) object; + + final Iterator<Stereotype> appliedStereotypes = element.getAppliedStereotypes().iterator(); + Iterator<String> keywords = new ArrayList<String>().iterator(); + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element)) { + keywords = element.getKeywords().iterator(); + } + + if (appliedStereotypes.hasNext() || keywords.hasNext()) { + + if (text.length() > 0) { + text.append(' '); // $NON-NLS-1$ + } + + text.append("<<"); //$NON-NLS-1$ + + while (appliedStereotypes.hasNext()) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element)) { + text.append(UMLLabelInternationalization.getInstance().getKeyword(appliedStereotypes.next(), shouldTranslate)); + } else { + text.append(appliedStereotypes.next().getName()); + } + + if (appliedStereotypes.hasNext() || keywords.hasNext()) { + text.append(", "); //$NON-NLS-1$ + } + } + + while (keywords.hasNext()) { + text.append(keywords.next()); + + if (keywords.hasNext()) { + text.append(", "); //$NON-NLS-1$ + } + } + + text.append(">>"); //$NON-NLS-1$ + } + } + + return text; + } + +} diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.classpath b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.classpath new file mode 100644 index 00000000000..4221242104f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.project b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.project new file mode 100644 index 00000000000..9031f64a5d4 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.project @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.internationalization.utils</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.oomph.version.VersionBuilder</name> + <arguments> + <dictionary> + <key>check.maven.pom</key> + <value>true</value> + </dictionary> + <dictionary> + <key>ignore.lower.bound.dependency.ranges</key> + <value>true</value> + </dictionary> + <dictionary> + <key>release.path</key> + <value>/org.eclipse.papyrus.releng.main.release/release.xml</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.oomph.version.VersionNature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/.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.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/META-INF/MANIFEST.MF b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..8ff2a5b5e61 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.uml.internationalization.utils;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, + org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)", + org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)" +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.papyrus.uml.internationalization.utils.Activator +Export-Package: org.eclipse.papyrus.uml.internationalization.utils.utils diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/about.html b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/about.html new file mode 100644 index 00000000000..598b3684879 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 12, 2008</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/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/build.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/build.properties new file mode 100644 index 00000000000..2964bc2d7b1 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/build.properties @@ -0,0 +1,11 @@ +# + +bin.includes = .,\ + META-INF/,\ + about.html,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.properties new file mode 100644 index 00000000000..b5d95b55d81 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = Papyrus Internationalization for UML Utils +providerName = Eclipse Modeling Project diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.xml new file mode 100644 index 00000000000..7ac51d15095 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/plugin.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- +--> + +<plugin> + +</plugin> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/pom.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/pom.xml new file mode 100644 index 00000000000..324f359c45f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml-internationalization</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.internationalization.utils</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/Activator.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/Activator.java new file mode 100644 index 00000000000..9611e36f3cf --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/Activator.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.utils; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.internationalization.utils"; //$NON-NLS-1$ + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The log helper. + */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final 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/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/utils/UMLLabelInternationalization.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/utils/UMLLabelInternationalization.java new file mode 100644 index 00000000000..daa579ae41f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization.utils/src/org/eclipse/papyrus/uml/internationalization/utils/utils/UMLLabelInternationalization.java @@ -0,0 +1,227 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.utils.utils; + +import java.util.Locale; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; + +/** + * The internationalization label manager for UML elements. + */ +public class UMLLabelInternationalization { + + /** + * The singleton instance. + */ + private static UMLLabelInternationalization instance; + + /** + * Constructor. + */ + protected UMLLabelInternationalization() { + + } + + /** + * Get the singleton instance (create it if not existing). + * + * @return The singleton instance. + */ + public static UMLLabelInternationalization getInstance() { + if (null == instance) { + instance = new UMLLabelInternationalization(); + } + return instance; + } + + /** + * This allows to get the label of the named element. + * + * @param namedElement + * The named element. + * @return The label of the named element or the name if the label is null. + */ + public String getLabel(final NamedElement namedElement) { + return getLabel(namedElement, true); + } + + /** + * This allows to get the label of the named element. + * + * @param namedElement + * The named element. + * @param localize + * Boolean to determinate if the locale must be used. + * @return The label of the named element or the name if the label is null. + */ + public String getLabel(final NamedElement namedElement, final boolean localize) { + String result = null; + if (null != namedElement.eResource() && InternationalizationPreferencesUtils.getInternationalizationPreference(namedElement)) { + result = getLabelWithoutUML(namedElement, localize); + } + return null != result ? result : namedElement.getName(); + } + + /** + * This allows to get the label of the named element without the getName + * when the label is null. + * + * @param namedElement + * The named element. + * @return The label of the named element. + */ + public String getLabelWithoutUML(final NamedElement namedElement) { + return getLabelWithoutUML(namedElement, true); + } + + /** + * This allows to get the label of the named element without the getName + * when the label is null. + * + * @param namedElement + * The named element. + * @param localize + * Boolean to determinate if the locale must be used. + * @return The label of the named element. + */ + public String getLabelWithoutUML(final NamedElement namedElement, final boolean localize) { + return LabelInternationalizationUtils.getLabelWithoutSubstract(namedElement, localize); + } + + /** + * This allows to set the named element label. + * + * @param namedElement + * The named element. + * @param value + * The label value. + * @param locale + * The locale for which set the value (if <code>null</code> set + * it for the current locale). + */ + public void setLabel(final NamedElement namedElement, final String value, final Locale locale) { + LabelInternationalizationUtils.setLabel(namedElement, value, locale); + } + + /** + * This allows to get the set named element label command. + * + * @param domain + * The editing domain to use. + * @param namedElement + * The named element. + * @param value + * The value to set. + * @param locale + * The locale for which set the value (if <code>null</code> set + * it for the current locale). + * @return The command which allow to set the named element label. + */ + public Command getSetLabelCommand(final EditingDomain domain, final NamedElement namedElement, final String value, final Locale locale) { + return LabelInternationalizationUtils.getSetLabelCommand(domain, namedElement, value, locale); + } + + /** + * This allows to get the keyword of the stereotype. + * + * @param stereotype + * The stereotype. + * @return The keyword of the stereotype or the name if the keyword is null. + */ + public String getKeyword(final Stereotype stereotype) { + return getKeyword(stereotype, true); + } + + /** + * This allows to get the keyword of the stereotype. + * + * @param stereotype + * The stereotype. + * @param localize + * Boolean to determinate if the locale must be used. + * @return The keyword of the stereotype or the name if the keyword is null. + */ + public String getKeyword(final Stereotype stereotype, final boolean localize) { + String result = null; + if (null != stereotype.eResource() && InternationalizationPreferencesUtils.getInternationalizationPreference(stereotype)) { + result = LabelInternationalizationUtils.getLabelWithoutSubstract(stereotype, localize); + } + return null != result ? result : stereotype.getName(); + } + + /** + * This allows to get the keyword of the stereotype without the getName when + * the keyword is null. + * + * @param stereotype + * The stereotype. + * @return The keyword of the stereotype. + */ + public String getKeywordWithoutUML(final Stereotype stereotype) { + return getKeywordWithoutUML(stereotype, true); + } + + /** + * This allows to get the keyword of the stereotype without the getName when + * the keyword is null. + * + * @param stereotype + * The stereotype. + * @param localize + * Boolean to determinate if the locale must be used. + * @return The keyword of the stereotype. + */ + public String getKeywordWithoutUML(final Stereotype stereotype, final boolean localize) { + return LabelInternationalizationUtils.getLabelWithoutSubstract(stereotype, localize); + } + + /** + * This allows to set the stereotype keyword. + * + * @param stereotype + * The stereotype. + * @param value + * The label value. + * @param locale + * The locale for which set the value (if <code>null</code> set + * it for the current locale). + */ + public void setKeyword(final Stereotype stereotype, final String value, final Locale locale) { + LabelInternationalizationUtils.setLabel(stereotype, value, locale); + } + + /** + * This allows to get the set stereotype keyword command. + * + * @param domain + * The editing domain to use. + * @param stereotype + * The stereotype. + * @param value + * The value to set. + * @param locale + * The locale for which set the value (if <code>null</code> set + * it for the current locale). + * @return The command which allow to set the stereotype keyword. + */ + public Command getSetKeywordCommand(final EditingDomain domain, final Stereotype stereotype, final String value, final Locale locale) { + return LabelInternationalizationUtils.getSetLabelCommand(domain, stereotype, value, locale); + } +} diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.classpath b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.classpath new file mode 100644 index 00000000000..4221242104f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.project b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.project new file mode 100644 index 00000000000..a3066a51d9f --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.project @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.internationalization</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.oomph.version.VersionBuilder</name> + <arguments> + <dictionary> + <key>check.maven.pom</key> + <value>true</value> + </dictionary> + <dictionary> + <key>ignore.lower.bound.dependency.ranges</key> + <value>true</value> + </dictionary> + <dictionary> + <key>release.path</key> + <value>/org.eclipse.papyrus.releng.main.release/release.xml</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.oomph.version.VersionNature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/.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.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/META-INF/MANIFEST.MF b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..3aad2e96e9c --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.uml.internationalization;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, + org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)", + org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", + org.eclipse.uml2.uml.edit;bundle-version="[5.1.0,6.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)", + org.eclipse.gmf.runtime.emf.commands.core;bundle-version="[1.7.0,2.0.0)" +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.papyrus.uml.internationalization.Activator +Export-Package: org.eclipse.papyrus.uml.internationalization.modelresource diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/about.html b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/about.html new file mode 100644 index 00000000000..598b3684879 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 12, 2008</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/uml/internationalization/org.eclipse.papyrus.uml.internationalization/build.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/build.properties new file mode 100644 index 00000000000..2964bc2d7b1 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/build.properties @@ -0,0 +1,11 @@ +# + +bin.includes = .,\ + META-INF/,\ + about.html,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.properties b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.properties new file mode 100644 index 00000000000..df492e7fada --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = Papyrus Internationalization for UML +providerName = Eclipse Modeling Project diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.xml new file mode 100644 index 00000000000..6ff809acfb0 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/plugin.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- +--> + +<plugin> + + <extension point="org.eclipse.papyrus.infra.core.model"> + <model + classname="org.eclipse.papyrus.uml.internationalization.modelresource.UMLInternationalizationModelResource" + description="Model for Papyrus UML internationalization" + fileExtension="properties" + required="false"> + <modelSnippet + classname="org.eclipse.papyrus.infra.internationalization.modelsnippet.PropertiesAdjunctResourceModelSnippet" + description="Snippet for properties resource of referenced model resources"> + </modelSnippet> + </model> + </extension> +</plugin> diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/pom.xml b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/pom.xml new file mode 100644 index 00000000000..635c98d950d --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml-internationalization</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.internationalization</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/Activator.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/Activator.java new file mode 100644 index 00000000000..58a53286ad7 --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/Activator.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.internationalization"; //$NON-NLS-1$ + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The log helper. + */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final 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/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/modelresource/UMLInternationalizationModelResource.java b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/modelresource/UMLInternationalizationModelResource.java new file mode 100644 index 00000000000..1a97d84d56b --- /dev/null +++ b/plugins/uml/internationalization/org.eclipse.papyrus.uml.internationalization/src/org/eclipse/papyrus/uml/internationalization/modelresource/UMLInternationalizationModelResource.java @@ -0,0 +1,223 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.internationalization.modelresource; + +import java.util.List; +import java.util.Locale; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry; +import org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary; +import org.eclipse.papyrus.infra.internationalization.commands.ResetNameCommand; +import org.eclipse.papyrus.infra.internationalization.commands.ResetNameTransactionalCommand; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource; +import org.eclipse.papyrus.uml.tools.utils.NameResolutionUtils; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.resource.UMLResource; + +/** + * This allows to manage the UML internationalization resource. + */ +public class UMLInternationalizationModelResource extends InternationalizationModelResource { + + /** + * The qualified name separator replacement into properties file. + */ + private static final String QUALIFIED_NAME_SEPARATOR_REPLACEMENT = "__"; //$NON-NLS-1$ + + /** + * Constructor. + */ + public UMLInternationalizationModelResource() { + super(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource#loadResource(org.eclipse.emf.common.util.URI, + * java.util.Locale) + */ + @Override + protected Resource loadResource(final URI uri, final Locale locale) { + Resource resource = super.loadResource(uri, locale); + + if (null != resource) { + convertInternationalizationToUMLElements(uri, locale); + } + + return resource; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource#createModel(org.eclipse.emf.common.util.URI) + */ + @Override + public void createModel(final URI uriWithoutExtension) { + super.createModel(uriWithoutExtension); + final URI uri = uriWithoutExtension.appendFileExtension(getModelFileExtension()); + convertInternationalizationToUMLElements(uri, InternationalizationPreferencesUtils.getLocalePreference(uri)); + } + + /** + * This allows to convert the internationalization entries from String to + * UML Named Element managed by their qualified names. + * + * @param uri + * The URI of the properties file with the extension. + * @param locale + * The locale to use. + */ + protected void convertInternationalizationToUMLElements(final URI uri, final Locale locale) { + final Resource resource = getResourceForURIAndLocale(uri, locale); + + if (null != resource && null != resource.getContents() && !resource.getContents().isEmpty()) { + final InternationalizationLibrary library = (InternationalizationLibrary) resource.getContents().get(0); + + for (final InternationalizationEntry entry : library.getEntries()) { + Object key = entry.getKey(); + if (key instanceof String) { + if (((String) key).startsWith(LABEL_PREFIX)) { + key = ((String) key).substring(LABEL_PREFIX.length()); + } + final String qualifiedName = ((String) key).replaceAll(QUALIFIED_NAME_SEPARATOR_REPLACEMENT, + NamedElementUtil.QUALIFIED_NAME_SEPARATOR); // $NON-NLS-1$ + + // TODO: is this the good way to get the named elements by + // qualified names? + final Resource umlResource = modelSet + .getResource(uri.trimFileExtension().appendFileExtension(UMLResource.FILE_EXTENSION), true); + if (null != umlResource && null != umlResource.getContents() + && !umlResource.getContents().isEmpty()) { + final List<NamedElement> elements = NameResolutionUtils.getNamedElements(qualifiedName, + ((Element) umlResource.getContents().get(0)), null); + + if (!elements.isEmpty() && 1 == elements.size()) { + final NamedElement umlElement = elements.get(0); + entry.setKey(umlElement); + addModifiedAdapter(umlElement, resource); + } + } + } + } + + resource.setModified(false); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource#getSetNameValueCommand(org.eclipse.emf.edit.domain.EditingDomain, + * org.eclipse.emf.ecore.EObject) + */ + @Override + protected Command getSetNameValueCommand(final EditingDomain domain, final EObject eObject) { + Command result = null; + + // Change name for named element + if (eObject instanceof NamedElement) { + if (domain instanceof TransactionalEditingDomain) { + result = new GMFtoEMFCommandWrapper(new ResetNameTransactionalCommand( + (TransactionalEditingDomain) domain, eObject, UMLPackage.eINSTANCE.getNamedElement_Name())); + } else { + result = new ResetNameCommand(domain, eObject, UMLPackage.eINSTANCE.getNamedElement_Name()); + } + } else { + result = super.getSetNameValueCommand(domain, eObject); + } + + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource#setNameValue(org.eclipse.emf.ecore.EObject) + */ + @Override + protected void setNameValue(final EObject eObject) { + + // Change name for named element + if (eObject instanceof NamedElement) { + String oldName = ((NamedElement) eObject).getName(); + ((NamedElement) eObject).setName(null); + ((NamedElement) eObject).setName(oldName); + } else { + super.setNameValue(eObject); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource#getKey(org.eclipse.papyrus.infra.internationalization.InternationalizationEntry) + */ + @Override + protected String getKey(final InternationalizationEntry entry) { + final StringBuilder stringBuilder = new StringBuilder(); + if (entry.getKey() instanceof NamedElement) { + + if (!(entry.getKey() instanceof Stereotype)) { + stringBuilder.append(LABEL_PREFIX); + } + + Resource umlResource = ((NamedElement) entry.getKey()).eResource(); + + Namespace superElementInSameResource = null; + + if (null != umlResource) { + for (final EObject eObjectContent : umlResource.getContents()) { + if (eObjectContent instanceof Namespace + && EcoreUtil.isAncestor(eObjectContent, (NamedElement) entry.getKey())) { + superElementInSameResource = (Namespace) eObjectContent; + } + } + } + + // Use the shortest qualified name for the control mode if needed + boolean shortestQualifiedNameUsed = false; + + if (superElementInSameResource.eContainer() != null) { + List<String> shortestQualifiedNames = NameResolutionUtils.getShortestQualifiedNames( + (NamedElement) entry.getKey(), (Namespace) superElementInSameResource.eContainer(), false); + if (!shortestQualifiedNames.isEmpty()) { + stringBuilder.append(shortestQualifiedNames.get(0).replaceAll( + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, QUALIFIED_NAME_SEPARATOR_REPLACEMENT)); + shortestQualifiedNameUsed = true; + } + } + if (!shortestQualifiedNameUsed) { + stringBuilder.append(((NamedElement) entry.getKey()).getQualifiedName() + .replaceAll(NamedElementUtil.QUALIFIED_NAME_SEPARATOR, QUALIFIED_NAME_SEPARATOR_REPLACEMENT)); + } + } + return 0 != stringBuilder.length() ? stringBuilder.toString() : super.getKey(entry); + } +}
\ No newline at end of file diff --git a/plugins/uml/internationalization/pom.xml b/plugins/uml/internationalization/pom.xml new file mode 100644 index 00000000000..b6161ff5716 --- /dev/null +++ b/plugins/uml/internationalization/pom.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml-internationalization</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>pom</packaging> + <name>Papyrus UML Internationalization</name> + <description>Papyrus Internationalization for UML..</description> + + <modules> + <module>org.eclipse.papyrus.uml.internationalization</module> + <module>org.eclipse.papyrus.uml.internationalization.edit</module> + <module>org.eclipse.papyrus.uml.internationalization.utils</module> + </modules> + +</project>
\ No newline at end of file diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF index 6f3f2626388..20f4fe64757 100644 --- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF +++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/META-INF/MANIFEST.MF @@ -1,7 +1,8 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.uml.modelexplorer.widgets Require-Bundle: org.eclipse.papyrus.views.modelexplorer.widgets;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.0.0.qualifier diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java index 82bb88227f9..379a5155c78 100644 --- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java +++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/NamedElementComparator.java @@ -1,40 +1,43 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.modelexplorer.widgets;
-
-import java.util.Comparator;
-
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * comparator UML NamedElement by taking in account their names
- *
- */
-public class NamedElementComparator implements Comparator<Object> {
-
- public int compare(Object namedElement0, Object namedElement1) {
- if (namedElement0 instanceof NamedElement && namedElement1 instanceof NamedElement) {
- String emp1Name = ((NamedElement) namedElement0).getName();
- String emp2Name = ((NamedElement) namedElement1).getName();
- // uses compareTo method of String class to compare names of the Eclasses
- return emp1Name.compareTo(emp2Name);
- }
- else {
- return 0;
- }
- }
-
-
-
-}
+/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.modelexplorer.widgets; + +import java.util.Comparator; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; + +/** + * comparator UML NamedElement by taking in account their names + * + */ +public class NamedElementComparator implements Comparator<Object> { + + public int compare(Object namedElement0, Object namedElement1) { + if (namedElement0 instanceof NamedElement && namedElement1 instanceof NamedElement) { + // TODO: This must manage getLabel() instead of getName() ? + String emp1Name = UMLLabelInternationalization.getInstance().getLabel((NamedElement) namedElement0); + String emp2Name = UMLLabelInternationalization.getInstance().getLabel((NamedElement) namedElement1); + // uses compareTo method of String class to compare names of the Eclasses + return emp1Name.compareTo(emp2Name); + } + else { + return 0; + } + } + + + +} diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java index 83c9b98a3b4..e46b3de9eaf 100644 --- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java +++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.widgets/src/org/eclipse/papyrus/uml/modelexplorer/widgets/StereotypeMetaclassLabelProvider.java @@ -1,32 +1,34 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.modelexplorer.widgets;
-
-import org.eclipse.papyrus.views.modelexplorer.widgets.MetaclassLabelProvider;
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * display the name of Eclass or stereotypes
- *
- */
-public class StereotypeMetaclassLabelProvider extends MetaclassLabelProvider {
-
- @Override
- public String getText(Object element) {
- if (element instanceof Stereotype) {
- return ((Stereotype) element).getName();
- }
- return super.getText(element);
- }
-}
+/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.modelexplorer.widgets; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.views.modelexplorer.widgets.MetaclassLabelProvider; +import org.eclipse.uml2.uml.Stereotype; + +/** + * display the name of Eclass or stereotypes + * + */ +public class StereotypeMetaclassLabelProvider extends MetaclassLabelProvider { + + @Override + public String getText(Object element) { + if (element instanceof Stereotype) { + return UMLLabelInternationalization.getInstance().getKeyword(((Stereotype) element)); + } + return super.getText(element); + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF index 5625fe89c20..bc3c5cd3978 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/META-INF/MANIFEST.MF @@ -1,7 +1,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.nebula.widgets.nattable.extension.glazedlists;bundle-version="[1.4.0,2.0.0)", org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.uml.nattable;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.nattable.stereotype.display, org.eclipse.papyrus.uml.nattable.stereotype.display.configuration, org.eclipse.papyrus.uml.nattable.stereotype.display.label.provider, diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/label/provider/StereotypeDisplayPropertyHeaderLabelProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/label/provider/StereotypeDisplayPropertyHeaderLabelProvider.java index 8c8c2e994ac..02da6c0d2c0 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/label/provider/StereotypeDisplayPropertyHeaderLabelProvider.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/label/provider/StereotypeDisplayPropertyHeaderLabelProvider.java @@ -32,6 +32,7 @@ import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtil import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper; import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes; import org.eclipse.papyrus.infra.widgets.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.nattable.messages.Messages; import org.eclipse.swt.graphics.Image; import org.eclipse.uml2.uml.AggregationKind; @@ -101,7 +102,7 @@ public class StereotypeDisplayPropertyHeaderLabelProvider extends EMFFeatureHead if (alias != null && !alias.isEmpty()) { returnedValue = alias; } else { - returnedValue = prop.getName();// getLabelProviderService(configRegistry).getLabelProvider(prop).getText(prop); + returnedValue = UMLLabelInternationalization.getInstance().getLabel(prop);// getLabelProviderService(configRegistry).getLabelProvider(prop).getText(prop); } if (conf != null) { if (alias != null && !alias.equals("")) { //$NON-NLS-1$ diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF index f2f550745d0..8d9d57aee06 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Export-Package: org.eclipse.papyrus.uml.nattable, Require-Bundle: org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml index f7e557177a3..0ffb58f6eca 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml @@ -212,6 +212,11 @@ manager="org.eclipse.papyrus.uml.nattable.manager.cell.StereotypePropertyCellManager" order="500"> </cellManager> + <cellManager + id="org.eclipse.papyrus.infra.emf.nattable.cell.operation.manager" + manager="org.eclipse.papyrus.uml.nattable.manager.cell.UMLOperationValueCellManager" + order="1150"> + </cellManager> </extension> <extension point="org.eclipse.papyrus.infra.nattable.tester"> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLOperationValueCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLOperationValueCellManager.java new file mode 100644 index 00000000000..fc4a3489332 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/UMLOperationValueCellManager.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.manager.cell; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.papyrus.infra.emf.nattable.manager.cell.EMFOperationValueCellManager; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Cell Manager which allows to get the value of an UML {@link EOperation} for an {@link EObject}. + */ +public class UMLOperationValueCellManager extends EMFOperationValueCellManager { + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.emf.nattable.manager.cell.EMFOperationValueCellManager#doGetValue(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + */ + @Override + protected Object doGetValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { + Object result = null; + + final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); + final EObject eobject = (EObject) objects.get(0); + final EOperation operation = (EOperation) objects.get(1); + + // If the operation called if the 'getLabel' from UML, call the papyrus internationalization 'getLabel' + if(eobject instanceof NamedElement && operation.equals(UMLPackage.eINSTANCE.getNamedElement__GetLabel())){ + result = UMLLabelInternationalization.getInstance().getLabel((NamedElement)eobject); + // If the operation called if the 'getKeyword' from UML, call the papyrus internationalization 'getKeyword' + }else if(eobject instanceof Stereotype && operation.equals(UMLPackage.eINSTANCE.getStereotype__GetKeyword())){ + result = UMLLabelInternationalization.getInstance().getKeyword((Stereotype)eobject); + }else{ + result = super.doGetValue(columnElement, rowElement, tableManager); + } + return result; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/StereotypePropertyHeaderLabelProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/StereotypePropertyHeaderLabelProvider.java index c1239532730..79d2b5b1378 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/StereotypePropertyHeaderLabelProvider.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/StereotypePropertyHeaderLabelProvider.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.nattable.provider; @@ -32,6 +33,7 @@ import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrap import org.eclipse.papyrus.infra.nattable.utils.LabelConfigurationManagementUtils; import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes; import org.eclipse.papyrus.infra.widgets.Activator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.nattable.messages.Messages; import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils; import org.eclipse.swt.graphics.Image; @@ -110,7 +112,7 @@ public class StereotypePropertyHeaderLabelProvider extends EMFFeatureHeaderLabel if (alias != null && !alias.isEmpty()) { returnedValue = alias; } else { - returnedValue = prop.getName();// getLabelProviderService(configRegistry).getLabelProvider(prop).getText(prop); + returnedValue = UMLLabelInternationalization.getInstance().getLabel(prop);// getLabelProviderService(configRegistry).getLabelProvider(prop).getText(prop); } if (conf != null) { if (alias != null && !alias.equals("")) { //$NON-NLS-1$ diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLTypedElementCellLabelProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLTypedElementCellLabelProvider.java index 2ca0882d483..3a56c181a76 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLTypedElementCellLabelProvider.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/provider/UMLTypedElementCellLabelProvider.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Nicolas FAUVERGUE - Initial API and implementation & Bug 458260 + * Nicolas FAUVERGUE - Initial API and implementation & Bug 458260 & Bug 496905 * *****************************************************************************/ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.nattable.provider; import org.eclipse.papyrus.infra.nattable.provider.GenericCellLabelProvider; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.TypedElement; /** @@ -33,7 +34,7 @@ public class UMLTypedElementCellLabelProvider extends GenericCellLabelProvider{ @Override protected String getElementText(LabelProviderService service, Object value){ if(value instanceof TypedElement){ - return ((TypedElement) value).getName(); + return UMLLabelInternationalization.getInstance().getLabel((TypedElement) value); } return super.getElementText(service, value); } diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF index 70068a5422a..2471b71dbbd 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/META-INF/MANIFEST.MF @@ -3,7 +3,9 @@ Require-Bundle: org.eclipse.emf;bundle-version="[2.6.0,3.0.0)", org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.commands.command Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java index 104bf92f569..0650c1c249a 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java @@ -9,26 +9,35 @@ * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation * Christian W. Damus - bug 506896 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.commands.handler; import java.util.List; +import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.UnexecutableCommand; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.emf.gmf.command.ICommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.infra.ui.command.AbstractCommandHandler; import org.eclipse.papyrus.infra.ui.command.InteractiveCommandWrapper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport; import org.eclipse.swt.widgets.Display; import org.eclipse.uml2.uml.NamedElement; @@ -49,30 +58,62 @@ public class RenameNamedElementHandler extends AbstractCommandHandler { EObject selectedElement = getSelectedElement(); if (selectedElement instanceof NamedElement) { final NamedElement namedElement = (NamedElement) selectedElement; - final String currentName = namedElement.getName(); + + // If the label exists, modify the label instead of name + final String label = UMLLabelInternationalization.getInstance().getLabelWithoutUML(namedElement); + if (null != label && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(namedElement)) { + AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "ChangeLabelCommand", null) { //$NON-NLS-1$ - if (currentName != null) { - result = new InteractiveCommandWrapper("Rename", "Change the name of an element") { + /** + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + * + * @param monitor + * @param info + * @return + * @throws ExecutionException + */ @Override - protected Command createCommand() { - Command result = UnexecutableCommand.INSTANCE; + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { + InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename label...", "New label:", label, null); //$NON-NLS-1$ //$NON-NLS-2$ + if (Window.OK == dialog.open()) { + final String label = dialog.getValue(); + if (label != null && label.length() > 0) { + UMLLabelInternationalization.getInstance().setLabel(namedElement, label, null); + } + return CommandResult.newOKCommandResult(); + } else { + return CommandResult.newCancelledCommandResult(); + } + } + }; + result = new GMFtoEMFCommandWrapper(cmd); + } else { + final String currentName = namedElement.getName(); + + if (currentName != null) { + result = new InteractiveCommandWrapper("Rename", "Change the name of an element") { + @Override + protected Command createCommand() { + Command result = UnexecutableCommand.INSTANCE; - InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename...", "New name:", currentName, null); - if (dialog.open() == Window.OK) { - String name = dialog.getValue(); + InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename...", "New name:", currentName, null); + if (dialog.open() == Window.OK) { + String name = dialog.getValue(); - if (!Strings.isNullOrEmpty(name) && !name.equals(currentName)) { - IElementEditService edit = ElementEditServiceUtils.getCommandProvider(namedElement); - SetRequest request = new SetRequest(editingDomain, namedElement, UMLPackage.Literals.NAMED_ELEMENT__NAME, name); - if (edit.canEdit(request)) { - result = ICommandWrapper.wrap(edit.getEditCommand(request), Command.class); + if (!Strings.isNullOrEmpty(name) && !name.equals(currentName)) { + IElementEditService edit = ElementEditServiceUtils.getCommandProvider(namedElement); + SetRequest request = new SetRequest(editingDomain, namedElement, UMLPackage.Literals.NAMED_ELEMENT__NAME, name); + if (edit.canEdit(request)) { + result = ICommandWrapper.wrap(edit.getEditCommand(request), Command.class); + } } } - } - return result; - } - }; + return result; + } + }; + } } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/META-INF/MANIFEST.MF index bd15718513b..3bc3bb408fd 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/META-INF/MANIFEST.MF @@ -1,7 +1,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)";visibility:=reexport, org.eclipse.ui.views.properties.tabbed;bundle-version="[3.7.0,4.0.0)", - org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.extensionpoints, org.eclipse.papyrus.uml.extensionpoints.library, org.eclipse.papyrus.uml.extensionpoints.metamodel, diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java index e51643da852..c3c6181f915 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredLibrarySelectionDialog.java @@ -9,6 +9,7 @@ * CEA List - initial API and implementation * Christian W. Damus (CEA) - bug 422257 * Dr. David H. Akehurst - enable programmatic registration + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *******************************************************************************/ package org.eclipse.papyrus.uml.extensionpoints.library; @@ -23,6 +24,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.uml.extensionpoints.Activator; import org.eclipse.papyrus.uml.extensionpoints.Registry; import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.uml2.uml.Element; @@ -99,7 +101,7 @@ public class RegisteredLibrarySelectionDialog extends ElementListSelectionDialog while (importedIt.hasNext()) { PackageImport currentImport = importedIt.next(); - String currentName = currentImport.getImportedPackage().getName(); + String currentName = UMLLabelInternationalization.getInstance().getLabel(currentImport.getImportedPackage()); Libraries.add(currentName); } diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java index 7e327f040ac..30115ca20bf 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/library/RegisteredProfileAsLibrarySelectionDialog.java @@ -9,6 +9,7 @@ * CEA List - initial API and implementation * Christian W. Damus (CEA) - bug 422257 * Dr. David H. Akehurst - enable programmatic registration + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *******************************************************************************/ package org.eclipse.papyrus.uml.extensionpoints.library; @@ -27,6 +28,7 @@ import org.eclipse.papyrus.uml.extensionpoints.Activator; import org.eclipse.papyrus.uml.extensionpoints.Registry; import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile; import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.uml2.uml.Element; @@ -105,7 +107,7 @@ public class RegisteredProfileAsLibrarySelectionDialog extends ElementListSelect while (importedIt.hasNext()) { PackageImport currentImport = importedIt.next(); - String currentName = currentImport.getImportedPackage().getName(); + String currentName = UMLLabelInternationalization.getInstance().getLabel(currentImport.getImportedPackage()); Libraries.add(currentName); } diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java index 915dcf70c72..589c759a624 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/metamodel/RegisteredMetamodelSelectionDialog.java @@ -9,6 +9,7 @@ * CEA List - initial API and implementation * Christian W. Damus (CEA) - bug 422257 * Dr. David H. Akehurst - enable programmatic registration + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *******************************************************************************/ package org.eclipse.papyrus.uml.extensionpoints.metamodel; @@ -23,6 +24,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.uml.extensionpoints.Activator; import org.eclipse.papyrus.uml.extensionpoints.Registry; import org.eclipse.papyrus.uml.extensionpoints.standard.ExtensionLabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.uml2.uml.Element; @@ -99,7 +101,7 @@ public class RegisteredMetamodelSelectionDialog extends ElementListSelectionDial while (importedIt.hasNext()) { PackageImport currentImport = importedIt.next(); - String currentName = currentImport.getImportedPackage().getName(); + String currentName = UMLLabelInternationalization.getInstance().getLabel(currentImport.getImportedPackage()); Metamodels.add(currentName); } diff --git a/plugins/uml/org.eclipse.papyrus.uml.navigation/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.navigation/META-INF/MANIFEST.MF index 989127987e4..7ec58b14b95 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.navigation/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.navigation/META-INF/MANIFEST.MF @@ -1,7 +1,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/CBANavigableElement.java b/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/CBANavigableElement.java index 4db8c9d8e99..f4bfea65b2f 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/CBANavigableElement.java +++ b/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/CBANavigableElement.java @@ -10,6 +10,7 @@ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Klaas Gadeyne (Flanders' Make) klaas.gadeyne@flandersmake.be - Extended for CallBehaviorActions, * see bug 453721 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *****************************************************************************/ package org.eclipse.papyrus.uml.navigation.navigableElement; @@ -20,9 +21,11 @@ import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderSer import org.eclipse.papyrus.infra.services.navigation.service.ExtendedNavigableElement; import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement; import org.eclipse.papyrus.infra.widgets.util.NavigationTarget; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Image; import org.eclipse.uml2.uml.Behavior; import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; /** * Navigates from a CallBehaviorAction to its Behavior declaration @@ -55,7 +58,7 @@ public class CBANavigableElement implements ExtendedNavigableElement { if (behavior == null) { return " (Undefined)"; } else { - return " (" + behavior.getName() + ")"; + return " (" + UMLLabelInternationalization.getInstance().getLabel(behavior) + ")"; } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/GenericNavigableElement.java b/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/GenericNavigableElement.java index 6c70adc289d..bd1cec4e6b9 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/GenericNavigableElement.java +++ b/plugins/uml/org.eclipse.papyrus.uml.navigation/src/org/eclipse/papyrus/uml/navigation/navigableElement/GenericNavigableElement.java @@ -7,7 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Shuai Li (CEA LIST) shuai.li@cea.fr - Initial API and implementation + * Shuai Li (CEA LIST) shuai.li@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *****************************************************************************/ package org.eclipse.papyrus.uml.navigation.navigableElement; @@ -18,6 +19,7 @@ import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderSer import org.eclipse.papyrus.infra.services.navigation.service.ExtendedNavigableElement; import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement; import org.eclipse.papyrus.infra.widgets.util.NavigationTarget; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.graphics.Image; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; @@ -55,7 +57,7 @@ public class GenericNavigableElement implements ExtendedNavigableElement { if (((NamedElement) element).getName() == null || ((NamedElement) element).getName().isEmpty()) { return " (Unnamed)"; // Often happens for Associations, as their name is derived in the UI } else { - return " (" + ((NamedElement) element).getName() + ")"; + return " (" + UMLLabelInternationalization.getInstance().getLabel((NamedElement) element) + ")"; } } else { return " (Unnamed)"; diff --git a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java index 5d80b205d2a..a62768da389 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java +++ b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java @@ -1,111 +1,112 @@ -/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.oclconstraintevaluation;
-
-
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.ocl.pivot.ExpressionInOCL;
-import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
-import org.eclipse.ocl.pivot.uml.UMLOCL;
-import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
-import org.eclipse.ocl.pivot.utilities.MetamodelManager;
-import org.eclipse.ocl.pivot.utilities.OCL;
-import org.eclipse.ocl.pivot.utilities.OCLHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * this is console that display the result of a OCL Constraint. The pattern Singleton has been applied
- *
- */
-public class OCLEvaluationView extends ViewPart {
-
- private Text textViewer;
-
- /**
- * ID
- */
- public static String ID = "org.eclipse.papyrus.uml.oclconstraintevaluation.OCLEvaluationView";
-
- protected MetamodelManager metamodelManager = null;
-
- /**
- *
- * Constructor.
- *
- */
- public OCLEvaluationView() {
- super();
- }
-
- @Override
- public void setFocus() {
- textViewer.setFocus();
- }
-
- @Override
- public void createPartControl(Composite parent) {
- textViewer = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- textViewer.setEditable(false);
- textViewer.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- }
-
- /**
- * this method comes from the org.eclipse.ocl.examples.xtext.console.OCLConsolePage written by
- *
- * @param contextObject
- * @return the metamodelManager
- */
- protected MetamodelManager getMetamodelManager(EObject contextObject) {
- EnvironmentFactory environmentFactory = PivotUtilInternal.findEnvironmentFactory(contextObject);
- if (environmentFactory != null) {
- return environmentFactory.getMetamodelManager();
- }
- return UMLOCL.newInstance().getMetamodelManager();
- }
-
-
-
- /**
- * allow to compute the constraint written in the string in the context of the EObject
- *
- * @param contextObject
- * the context of the constraint
- * @param expression
- * the constraint
- */
- public void compute(EObject contextObject, String expression) {
- // initialize the context of an evaluation of the OCL expression
- MetamodelManager metamodelManager = getMetamodelManager(contextObject);
- EnvironmentFactory environmentFactory = metamodelManager.getEnvironmentFactory();
- OCL ocl = OCL.newInstance(environmentFactory);
- org.eclipse.ocl.pivot.Class contextType = ocl.getContextType(contextObject);
- try {
- OCLHelper oclHelper = ocl.createOCLHelper(contextType);
- ExpressionInOCL createQuery = oclHelper.createQuery(expression);
- Object evaluate = ocl.evaluate(contextObject, createQuery);
- String print = evaluate.toString();
-
- // display the value
- textViewer.setText("value = " + print);
- } catch (Exception ex) {
- textViewer.setText("\nERROR " + ex);
- }
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.oclconstraintevaluation; + + + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.ocl.pivot.ExpressionInOCL; +import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal; +import org.eclipse.ocl.pivot.uml.UMLOCL; +import org.eclipse.ocl.pivot.utilities.EnvironmentFactory; +import org.eclipse.ocl.pivot.utilities.MetamodelManager; +import org.eclipse.ocl.pivot.utilities.OCL; +import org.eclipse.ocl.pivot.utilities.OCLHelper; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.part.ViewPart; + +/** + * this is console that display the result of a OCL Constraint. The pattern Singleton has been applied + * + */ +public class OCLEvaluationView extends ViewPart { + + private Text textViewer; + + /** + * ID + */ + public static String ID = "org.eclipse.papyrus.uml.oclconstraintevaluation.OCLEvaluationView"; + + protected MetamodelManager metamodelManager = null; + + /** + * + * Constructor. + * + */ + public OCLEvaluationView() { + super(); + } + + @Override + public void setFocus() { + textViewer.setFocus(); + } + + @Override + public void createPartControl(Composite parent) { + textViewer = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); + textViewer.setEditable(false); + textViewer.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + } + + /** + * this method comes from the org.eclipse.ocl.examples.xtext.console.OCLConsolePage written by + * + * @param contextObject + * @return the metamodelManager + */ + protected MetamodelManager getMetamodelManager(EObject contextObject) { + EnvironmentFactory environmentFactory = PivotUtilInternal.findEnvironmentFactory(contextObject); + if (environmentFactory != null) { + return environmentFactory.getMetamodelManager(); + } + return UMLOCL.newInstance().getMetamodelManager(); + } + + + + /** + * allow to compute the constraint written in the string in the context of the EObject + * + * @param contextObject + * the context of the constraint + * @param expression + * the constraint + */ + public void compute(EObject contextObject, String expression) { + // initialize the context of an evaluation of the OCL expression + MetamodelManager metamodelManager = getMetamodelManager(contextObject); + EnvironmentFactory environmentFactory = metamodelManager.getEnvironmentFactory(); + OCL ocl = OCL.newInstance(environmentFactory); + org.eclipse.ocl.pivot.Class contextType = ocl.getContextType(contextObject); + try { + OCLHelper oclHelper = ocl.createOCLHelper(contextType); + ExpressionInOCL createQuery = oclHelper.createQuery(expression); + Object evaluate = ocl.evaluate(contextObject, createQuery); + String print = evaluate.toString(); + + // display the value + textViewer.setText("value = " + print); + } catch (Exception ex) { + textViewer.setText("\nERROR " + ex); + } + + } +}
\ No newline at end of file diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF index 765316e812b..b5bbee64948 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0 org.eclipse.papyrus.uml.extensionpoints;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.uml2.uml.editor;bundle-version="[5.2.0,6.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.modelrepair;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.modelrepair;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/DisplayedProfileElementLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/DisplayedProfileElementLabelProvider.java index e6229174d01..f8f9175ae90 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/DisplayedProfileElementLabelProvider.java +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/DisplayedProfileElementLabelProvider.java @@ -10,6 +10,7 @@ * Contributors: * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.profile.tree; @@ -21,6 +22,7 @@ import org.eclipse.emf.common.util.Enumerator; import org.eclipse.emf.ecore.EEnumLiteral; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.ImageManager; import org.eclipse.papyrus.uml.profile.Message; import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTreeObject; @@ -168,7 +170,7 @@ public class DisplayedProfileElementLabelProvider extends LabelProvider { if (object instanceof AppliedStereotypeTreeObject) { Stereotype st = ((AppliedStereotypeTreeObject) object).getStereotype(); - String stName = st.getName(); + String stName = UMLLabelInternationalization.getInstance().getKeyword(st); String profileName = st.getProfile().getQualifiedName(); String label = stName + TAB + "(from " + profileName + ")"; return label; @@ -373,8 +375,8 @@ public class DisplayedProfileElementLabelProvider extends LabelProvider { */ private String getPropertyShortLabel(Property property) { Type type = property.getType(); - String typeName = type.getName(); - String name = property.getName(); + String typeName = UMLLabelInternationalization.getInstance().getLabel(type); + String name = UMLLabelInternationalization.getInstance().getLabel(property); return name + ": " + typeName + " " + MultiplicityElementUtil.formatMultiplicity(property); } @@ -477,7 +479,7 @@ public class DisplayedProfileElementLabelProvider extends LabelProvider { } if (eLiteral != null) { - return eLiteral.getName(); + return UMLLabelInternationalization.getInstance().getLabel(eLiteral); } else { return "undefined"; } diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java index b28d8caca63..8a11ec8a966 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java @@ -1,711 +1,713 @@ -/*****************************************************************************
- * Copyright (c) 2008, 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
- * Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
-import org.eclipse.jface.viewers.ComboBoxViewerCellEditor;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.papyrus.uml.profile.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.DataType;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Enumeration;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageableElement;
-import org.eclipse.uml2.uml.PrimitiveType;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.util.UMLSwitch;
-
-
-
-/**
- * this is a dialog to select an element import
- *
- */
-// FIXME: This dialog should be moved to another plug-in
-public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog {
-
- private final Class<E> elementType;
-
- protected List<Package> packages;
-
- protected final EnumSet<ImportAction> allowedActions;
-
- protected boolean subSelection = false;
-
- private Set<E> initialSelections = new java.util.HashSet<E>();
-
- private Map<E, ImportSpec<E>> importSpecs = new java.util.HashMap<E, ImportSpec<E>>();
-
- /**
- *
- */
- protected List<ImportSpec<E>> elementsToImport = new ArrayList<ImportSpec<E>>();
-
- /**
- *
- */
- protected CheckboxTreeViewer elementTree;
-
- /**
- *
- */
- protected static final Image IMG_PACKAGE = ImageManager.IMG_PACKAGE;
-
- /**
- *
- */
- protected static final Image IMG_CLASS = ImageManager.IMG_CLASS;
-
- /**
- *
- */
- protected static final Image IMG_DATATYPE = ImageManager.IMG_DATATYPE;
-
- /**
- *
- */
- protected static final Image IMG_ENUM = ImageManager.IMG_ENUMERATION;
-
- /**
- *
- */
- protected static final Image IMG_PRIMITIVE = ImageManager.IMG_PRIMITIVETYPE;
-
- protected static final Image IMG_PROFILE = ImageManager.IMG_PROFILE;
-
- /**
- *
- */
- protected static final Image IMG_ASSOCIATION = ImageManager.IMG_ASSOCIATION;
-
- /**
- *
- */
- protected static final Image IMG_INSTANCESPEC = ImageManager.IMG_INSTANCESPEC;
-
-
- /**
- * @param parent
- * the parent shell
- * @param action
- * the implicit import action (the user doesn't have a choice)
- * @param model
- * the UML model of profile or import library
- */
- public ElementImportTreeSelectionDialog(Shell parent, ImportAction action, Class<E> elementType, Package model) {
- this(parent, EnumSet.of(action), elementType, Collections.singletonList(model));
- }
-
- /**
- * @param parent
- * the parent shell
- * @param action
- * the implicit import action (the user doesn't have a choice)
- * @param model
- * the UML models or profiles or import libraries
- */
- public ElementImportTreeSelectionDialog(Shell parent, ImportAction action, Class<E> elementType, Collection<? extends Package> models) {
- this(parent, EnumSet.of(action), elementType, models);
- }
-
- /**
- * @param parent
- * the parent shell
- * @param allowedActions
- * the import actions that the user may choose from
- * @param model
- * the UML model of profile or import library
- */
- public ElementImportTreeSelectionDialog(Shell parent, Set<ImportAction> allowedActions, Class<E> elementType, Package model) {
- this(parent, allowedActions, elementType, Collections.singletonList(model));
- }
-
- /**
- *
- *
- * @param model
- * @param allowedActions
- * the import actions that the user may choose from
- * @param parent
- */
- public ElementImportTreeSelectionDialog(Shell parent, Set<ImportAction> allowedActions, Class<E> elementType, Collection<? extends Package> models) {
- super(parent);
-
- this.allowedActions = EnumSet.copyOf(allowedActions);
- this.elementType = elementType;
- this.packages = new java.util.ArrayList<Package>(models);
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText("Select the elements to import");
- }
-
- /**
- *
- *
- * @param parent
- *
- * @return
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite comp = (Composite) super.createDialogArea(parent);
- Tree tree = new Tree(comp, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL);
- GridData treeData = new GridData(SWT.FILL, SWT.FILL, true, true);
- treeData.widthHint = 300;
- treeData.heightHint = 300;
- tree.setLayoutData(treeData);
-
- tree.addListener(SWT.Selection, new Listener() {
-
- public void handleEvent(Event event) {
- if (event.detail == SWT.CHECK) {
- handleCheckStateChanged(getImportSpec(event.item));
- }
- }
- });
-
- elementTree = new CheckboxTreeViewer(tree);
-
- // create tree column for element
- TreeViewerColumn col = new TreeViewerColumn(elementTree, SWT.NONE);
- col.getColumn().setText("Import");
- col.getColumn().setWidth(300);
- col.getColumn().setResizable(true);
- col.setLabelProvider(new CellLabelProvider() {
-
- @Override
- public void update(ViewerCell cell) {
- ImportSpec<?> importSpec = (ImportSpec<?>) cell.getElement();
- cell.setImage(getElementImage(importSpec.getElement()));
- cell.setText(getElementText(importSpec.getElement()));
- }
-
- @Override
- public String getToolTipText(Object element) {
- ImportSpec<?> importSpec = (ImportSpec<?>) element;
-
- return ((EObject) importSpec.getElement()).eResource().getURI().toString();
- }
- });
- ColumnViewerToolTipSupport.enableFor(elementTree);
-
- if (allowedActions.size() > 1) {
- tree.setHeaderVisible(true);
- col.getColumn().setWidth(220);
-
- // create tree column for action
- col = new TreeViewerColumn(elementTree, SWT.NONE);
- col.getColumn().setText("Action");
- col.getColumn().setWidth(80);
- col.getColumn().setResizable(true);
- col.setLabelProvider(new CellLabelProvider() {
-
- @Override
- public void update(ViewerCell cell) {
- ImportSpec<?> importSpec = (ImportSpec<?>) cell.getElement();
- cell.setText(getDisplayName(importSpec.getAction()));
- }
- });
- col.setEditingSupport(new ImportActionEditingSupport(elementTree));
- }
-
- elementTree.setContentProvider(new ElementTreeContentProvider());
- elementTree.setInput(packages);
- elementTree.expandAll();
-
- // post a selection of the initially selected elements
- tree.getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- for (E next : initialSelections) {
- ImportSpec<E> importSpec = getImportSpec(next);
- if (importSpec != null) {
- elementTree.setChecked(importSpec, true);
- handleCheckStateChanged(importSpec);
- }
- }
- }
- });
-
- return comp;
- }
-
- protected void handleCheckStateChanged(ImportSpec<E> importSpec) {
- if (!elementTree.getChecked(importSpec)) {
- removeResult(importSpec);
-
- } else {
- addResult(importSpec);
- }
- }
-
- protected void setInitialSelection(E element) {
- initialSelections.add(element);
- }
-
- protected String getDisplayName(ImportAction importAction) {
- String result;
-
- switch (importAction) {
- case IMPORT:
- result = "Import";
- break;
- case APPLY:
- result = "Apply";
- break;
- case COPY:
- result = "Copy";
- break;
- case LOAD:
- result = "Load";
- break;
- default:
- result = "<none>";
- }
-
- return result;
- }
-
- /**
- * Recursive call that Check item childrens in the tree
- *
- * @param item
- */
- @SuppressWarnings("unchecked")
- protected void addChildSelection(ImportSpec<E> item) {
- ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider();
- for (Object next : provider.getChildren(item)) {
- elementTree.setChecked(next, true);
- addResult((ImportSpec<E>) next);
- }
- }
-
- /**
- * Recursive call that unCheck item childrens in the tree
- *
- * @param item
- */
- @SuppressWarnings("unchecked")
- protected void remChildSelection(ImportSpec<E> item) {
- ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider();
- for (Object next : provider.getChildren(item)) {
- elementTree.setChecked(next, false);
- removeResult((ImportSpec<E>) next);
- }
- }
-
- protected String getElementText(Element element) {
- String result = null;
-
- if (element instanceof NamedElement) {
- result = ((NamedElement) element).getName();
- }
-
- return (result == null) ? "" : result;
- }
-
- protected Image getElementImage(Element element) {
- return new UMLSwitch<Image>() {
-
- @Override
- public Image casePackage(Package object) {
- return IMG_PACKAGE;
- }
-
- @Override
- public Image caseProfile(Profile object) {
- return IMG_PROFILE;
- }
-
- @Override
- public Image caseAssociation(Association object) {
- return IMG_ASSOCIATION;
- }
-
- @Override
- public Image caseEnumeration(Enumeration object) {
- return IMG_ENUM;
- }
-
- @Override
- public Image casePrimitiveType(PrimitiveType object) {
- return IMG_PRIMITIVE;
- }
-
- @Override
- public Image caseDataType(DataType object) {
- return IMG_DATATYPE;
- }
-
- @Override
- public Image caseClass(org.eclipse.uml2.uml.Class object) {
- return IMG_CLASS;
- }
-
- @Override
- public Image caseInstanceSpecification(InstanceSpecification object) {
- return IMG_INSTANCESPEC;
- }
- }.doSwitch(element);
- }
-
- /**
- * Returns the elements to import.
- *
- * @return
- */
- public Collection<ImportSpec<E>> getResult() {
- return elementsToImport;
- }
-
- protected Collection<? extends Element> getChildren(Package package_) {
- Collection<Element> result = new java.util.ArrayList<Element>();
-
- Iterator<PackageableElement> elemIter = package_.getPackagedElements().iterator();
- while (elemIter.hasNext()) {
- Element elem = elemIter.next();
- if (elem instanceof NamedElement) {
- result.add(elem);
- }
- }
-
- return result;
- }
-
- protected ImportSpec<E> createImportSpec(Element element) {
- @SuppressWarnings("unchecked")
- ImportSpec<E> result = new ImportSpec<E>((E) element);
- if (elementType.isInstance(element) && !allowedActions.isEmpty()) {
- result.setAction(allowedActions.iterator().next());
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- protected ImportSpec<E> getImportSpec(Element element) {
- ImportSpec<E> result = importSpecs.get(element);
- if (result == null) {
- result = createImportSpec(element);
- importSpecs.put((E) element, result);
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- protected ImportSpec<E> getImportSpec(Widget item) {
- return (ImportSpec<E>) item.getData();
- }
-
- protected <T extends E> Iterator<T> getAllElementsOfType(final Class<T> type) {
- return filter(EcoreUtil.getAllContents(packages), type);
-
- }
-
- private <T> Iterator<T> filter(final Iterator<?> iterator, final Class<T> type) {
- return new Iterator<T>() {
-
- private final Iterator<?> delegate = iterator;
-
- private T next;
-
- public boolean hasNext() {
- if (next == null) {
- while (delegate.hasNext()) {
- Object next = delegate.next();
- if (type.isInstance(next)) {
- this.next = type.cast(next);
- break;
- }
- }
- }
-
- return next != null;
- }
-
- public T next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
-
- T result = next;
- next = null;
- return result;
- }
-
- public void remove() {
- throw new UnsupportedOperationException("remove");
- }
- };
- }
-
- protected <T extends E> Iterator<T> getRootElementsOfType(final Class<T> type) {
- return filter(packages.iterator(), type);
- }
-
- protected void selectAll(ImportAction action) {
- Iterator<E> iter;
-
- // if we propagate selections to children, then we need to cover the
- // entire tree. Otherwise, we process only the root packages because
- // the nested packages are imported/copied recursively
- if ((action == ImportAction.NONE) || subSelection) {
- iter = getAllElementsOfType(elementType);
- } else {
- // first, clear selection of any nested packages
- selectAll(ImportAction.NONE);
- iter = getRootElementsOfType(elementType);
- }
-
- while (iter.hasNext()) {
- ImportSpec<E> importSpec = getImportSpec(iter.next());
- if (action == ImportAction.NONE) {
- if (elementTree.getChecked(importSpec)) {
- elementTree.setChecked(importSpec, false);
- removeResult(importSpec);
- }
- } else {
- if (!elementTree.getChecked(importSpec)) {
- elementTree.setChecked(importSpec, true);
- addResult(importSpec);
- }
- importSpec.setAction(action);
- }
- elementTree.update(importSpec, null);
- }
- }
-
- protected void addResult(ImportSpec<E> importSpec) {
- if (!elementsToImport.contains(importSpec)) {
- elementsToImport.add(importSpec);
- }
- if (subSelection) {
- addChildSelection(importSpec);
- }
- }
-
- protected void removeResult(ImportSpec<E> importSpec) {
- // bug fix when list is already initialized, it can have several instance of the same element
- while (elementsToImport.contains(importSpec)) {
- elementsToImport.remove(importSpec);
- }
- if (subSelection) {
- remChildSelection(importSpec);
- }
- }
-
- //
- // Nested types
- //
-
- public static class ImportSpec<E extends Element> {
-
- private final E element;
-
- private ImportAction action = ImportAction.NONE;
-
- protected ImportSpec(E element) {
- this.element = element;
- }
-
- public E getElement() {
- return element;
- }
-
- public ImportAction getAction() {
- return action;
- }
-
- public void setAction(ImportAction action) {
- this.action = (action == null) ? ImportAction.NONE : action;
- }
-
- @Override
- public String toString() {
- return String.format("<%s> %s", action, element);
- }
- }
-
- /**
- * Enumeration of the possible actions to apply to an element that is
- * selected for import.
- */
- public static enum ImportAction {
- /** Do not import the element. */
- NONE,
- /** Loads the resource */
- LOAD,
- /** Import the element or package. */
- IMPORT,
- /** Apply the profile (only applicable to profiles). */
- APPLY,
- /** Copy the element or package. */
- COPY;
- }
-
- private class ElementTreeContentProvider implements ITreeContentProvider {
-
- public Object[] getElements(Object inputElement) {
- List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>(packages.size());
-
- for (Package next : packages) {
- result.add(getImportSpec(next));
- }
-
- return result.toArray();
- }
-
- public Object[] getChildren(Object parentElement) {
- List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>();
-
- Element parent = ((ImportSpec<?>) parentElement).getElement();
- if (parent instanceof Package) {
- for (Element next : ElementImportTreeSelectionDialog.this.getChildren((Package) parent)) {
-
- result.add(getImportSpec(next));
- }
- }
-
- return result.toArray();
- }
-
- public boolean hasChildren(Object element) {
- Element parent = ((ImportSpec<?>) element).getElement();
- return parent instanceof Package;
- }
-
- public Object getParent(Object element) {
- ImportSpec<?> result = null;
-
- ImportSpec<?> importSpec = (ImportSpec<?>) element;
- Element parent = ((Element) importSpec.getElement()).getOwner();
-
- if ((parent != null) && (importSpecs.containsKey(parent))) {
- result = importSpecs.get(parent);
- }
-
- return result;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // pass
- }
-
- public void dispose() {
- // pass
- }
- }
-
- private class ImportActionEditingSupport extends EditingSupport {
-
- private ComboBoxViewerCellEditor editor;
-
- public ImportActionEditingSupport(ColumnViewer viewer) {
- super(viewer);
- }
-
- @Override
- protected CellEditor getCellEditor(Object element) {
- if (editor == null) {
- editor = new ComboBoxViewerCellEditor((Tree) getViewer().getControl(), SWT.BORDER);
- editor.setLabelProvider(new LabelProvider() {
-
- @Override
- public String getText(Object element) {
- return getDisplayName((ImportAction) element);
- }
- });
- editor.setContentProvider(ArrayContentProvider.getInstance());
- editor.setInput(allowedActions);
- }
-
- return editor;
- }
-
- @Override
- protected boolean canEdit(Object element) {
- // can't import elements of the wrong type
- ImportSpec<?> spec = (ImportSpec<?>) element;
- return elementType.isInstance(spec.getElement());
- }
-
- @Override
- protected Object getValue(Object element) {
- ImportSpec<?> spec = (ImportSpec<?>) element;
-
- return elementType.isInstance(spec.getElement()) ? spec.getAction() : ImportAction.NONE;
- }
-
- @Override
- protected void setValue(final Object element, Object value) {
- @SuppressWarnings("unchecked")
- ImportSpec<E> importSpec = (ImportSpec<E>) element;
- importSpec.setAction((ImportAction) value);
-
- // if the user is setting the import action, he wants it imported
- if (!elementTree.getChecked(importSpec)) {
- elementTree.setChecked(importSpec, true);
- addResult(importSpec);
- }
-
- editor.getControl().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- elementTree.update(element, null);
- }
- });
- }
-
- }
-}
+/***************************************************************************** + * Copyright (c) 2008, 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.profile.ui.dialogs; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.CheckboxTreeViewer; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.ComboBoxViewerCellEditor; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.profile.ImageManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.Widget; +import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.DataType; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Enumeration; +import org.eclipse.uml2.uml.InstanceSpecification; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.PackageableElement; +import org.eclipse.uml2.uml.PrimitiveType; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.util.UMLSwitch; + + + +/** + * this is a dialog to select an element import + * + */ +// FIXME: This dialog should be moved to another plug-in +public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog { + + private final Class<E> elementType; + + protected List<Package> packages; + + protected final EnumSet<ImportAction> allowedActions; + + protected boolean subSelection = false; + + private Set<E> initialSelections = new java.util.HashSet<E>(); + + private Map<E, ImportSpec<E>> importSpecs = new java.util.HashMap<E, ImportSpec<E>>(); + + /** + * + */ + protected List<ImportSpec<E>> elementsToImport = new ArrayList<ImportSpec<E>>(); + + /** + * + */ + protected CheckboxTreeViewer elementTree; + + /** + * + */ + protected static final Image IMG_PACKAGE = ImageManager.IMG_PACKAGE; + + /** + * + */ + protected static final Image IMG_CLASS = ImageManager.IMG_CLASS; + + /** + * + */ + protected static final Image IMG_DATATYPE = ImageManager.IMG_DATATYPE; + + /** + * + */ + protected static final Image IMG_ENUM = ImageManager.IMG_ENUMERATION; + + /** + * + */ + protected static final Image IMG_PRIMITIVE = ImageManager.IMG_PRIMITIVETYPE; + + protected static final Image IMG_PROFILE = ImageManager.IMG_PROFILE; + + /** + * + */ + protected static final Image IMG_ASSOCIATION = ImageManager.IMG_ASSOCIATION; + + /** + * + */ + protected static final Image IMG_INSTANCESPEC = ImageManager.IMG_INSTANCESPEC; + + + /** + * @param parent + * the parent shell + * @param action + * the implicit import action (the user doesn't have a choice) + * @param model + * the UML model of profile or import library + */ + public ElementImportTreeSelectionDialog(Shell parent, ImportAction action, Class<E> elementType, Package model) { + this(parent, EnumSet.of(action), elementType, Collections.singletonList(model)); + } + + /** + * @param parent + * the parent shell + * @param action + * the implicit import action (the user doesn't have a choice) + * @param model + * the UML models or profiles or import libraries + */ + public ElementImportTreeSelectionDialog(Shell parent, ImportAction action, Class<E> elementType, Collection<? extends Package> models) { + this(parent, EnumSet.of(action), elementType, models); + } + + /** + * @param parent + * the parent shell + * @param allowedActions + * the import actions that the user may choose from + * @param model + * the UML model of profile or import library + */ + public ElementImportTreeSelectionDialog(Shell parent, Set<ImportAction> allowedActions, Class<E> elementType, Package model) { + this(parent, allowedActions, elementType, Collections.singletonList(model)); + } + + /** + * + * + * @param model + * @param allowedActions + * the import actions that the user may choose from + * @param parent + */ + public ElementImportTreeSelectionDialog(Shell parent, Set<ImportAction> allowedActions, Class<E> elementType, Collection<? extends Package> models) { + super(parent); + + this.allowedActions = EnumSet.copyOf(allowedActions); + this.elementType = elementType; + this.packages = new java.util.ArrayList<Package>(models); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Select the elements to import"); + } + + /** + * + * + * @param parent + * + * @return + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + Tree tree = new Tree(comp, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL); + GridData treeData = new GridData(SWT.FILL, SWT.FILL, true, true); + treeData.widthHint = 300; + treeData.heightHint = 300; + tree.setLayoutData(treeData); + + tree.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + if (event.detail == SWT.CHECK) { + handleCheckStateChanged(getImportSpec(event.item)); + } + } + }); + + elementTree = new CheckboxTreeViewer(tree); + + // create tree column for element + TreeViewerColumn col = new TreeViewerColumn(elementTree, SWT.NONE); + col.getColumn().setText("Import"); + col.getColumn().setWidth(300); + col.getColumn().setResizable(true); + col.setLabelProvider(new CellLabelProvider() { + + @Override + public void update(ViewerCell cell) { + ImportSpec<?> importSpec = (ImportSpec<?>) cell.getElement(); + cell.setImage(getElementImage(importSpec.getElement())); + cell.setText(getElementText(importSpec.getElement())); + } + + @Override + public String getToolTipText(Object element) { + ImportSpec<?> importSpec = (ImportSpec<?>) element; + + return ((EObject) importSpec.getElement()).eResource().getURI().toString(); + } + }); + ColumnViewerToolTipSupport.enableFor(elementTree); + + if (allowedActions.size() > 1) { + tree.setHeaderVisible(true); + col.getColumn().setWidth(220); + + // create tree column for action + col = new TreeViewerColumn(elementTree, SWT.NONE); + col.getColumn().setText("Action"); + col.getColumn().setWidth(80); + col.getColumn().setResizable(true); + col.setLabelProvider(new CellLabelProvider() { + + @Override + public void update(ViewerCell cell) { + ImportSpec<?> importSpec = (ImportSpec<?>) cell.getElement(); + cell.setText(getDisplayName(importSpec.getAction())); + } + }); + col.setEditingSupport(new ImportActionEditingSupport(elementTree)); + } + + elementTree.setContentProvider(new ElementTreeContentProvider()); + elementTree.setInput(packages); + elementTree.expandAll(); + + // post a selection of the initially selected elements + tree.getDisplay().asyncExec(new Runnable() { + + public void run() { + for (E next : initialSelections) { + ImportSpec<E> importSpec = getImportSpec(next); + if (importSpec != null) { + elementTree.setChecked(importSpec, true); + handleCheckStateChanged(importSpec); + } + } + } + }); + + return comp; + } + + protected void handleCheckStateChanged(ImportSpec<E> importSpec) { + if (!elementTree.getChecked(importSpec)) { + removeResult(importSpec); + + } else { + addResult(importSpec); + } + } + + protected void setInitialSelection(E element) { + initialSelections.add(element); + } + + protected String getDisplayName(ImportAction importAction) { + String result; + + switch (importAction) { + case IMPORT: + result = "Import"; + break; + case APPLY: + result = "Apply"; + break; + case COPY: + result = "Copy"; + break; + case LOAD: + result = "Load"; + break; + default: + result = "<none>"; + } + + return result; + } + + /** + * Recursive call that Check item childrens in the tree + * + * @param item + */ + @SuppressWarnings("unchecked") + protected void addChildSelection(ImportSpec<E> item) { + ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider(); + for (Object next : provider.getChildren(item)) { + elementTree.setChecked(next, true); + addResult((ImportSpec<E>) next); + } + } + + /** + * Recursive call that unCheck item childrens in the tree + * + * @param item + */ + @SuppressWarnings("unchecked") + protected void remChildSelection(ImportSpec<E> item) { + ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider(); + for (Object next : provider.getChildren(item)) { + elementTree.setChecked(next, false); + removeResult((ImportSpec<E>) next); + } + } + + protected String getElementText(Element element) { + String result = null; + + if (element instanceof NamedElement) { + result = UMLLabelInternationalization.getInstance().getLabel(((NamedElement) element)); + } + + return (result == null) ? "" : result; + } + + protected Image getElementImage(Element element) { + return new UMLSwitch<Image>() { + + @Override + public Image casePackage(Package object) { + return IMG_PACKAGE; + } + + @Override + public Image caseProfile(Profile object) { + return IMG_PROFILE; + } + + @Override + public Image caseAssociation(Association object) { + return IMG_ASSOCIATION; + } + + @Override + public Image caseEnumeration(Enumeration object) { + return IMG_ENUM; + } + + @Override + public Image casePrimitiveType(PrimitiveType object) { + return IMG_PRIMITIVE; + } + + @Override + public Image caseDataType(DataType object) { + return IMG_DATATYPE; + } + + @Override + public Image caseClass(org.eclipse.uml2.uml.Class object) { + return IMG_CLASS; + } + + @Override + public Image caseInstanceSpecification(InstanceSpecification object) { + return IMG_INSTANCESPEC; + } + }.doSwitch(element); + } + + /** + * Returns the elements to import. + * + * @return + */ + public Collection<ImportSpec<E>> getResult() { + return elementsToImport; + } + + protected Collection<? extends Element> getChildren(Package package_) { + Collection<Element> result = new java.util.ArrayList<Element>(); + + Iterator<PackageableElement> elemIter = package_.getPackagedElements().iterator(); + while (elemIter.hasNext()) { + Element elem = elemIter.next(); + if (elem instanceof NamedElement) { + result.add(elem); + } + } + + return result; + } + + protected ImportSpec<E> createImportSpec(Element element) { + @SuppressWarnings("unchecked") + ImportSpec<E> result = new ImportSpec<E>((E) element); + if (elementType.isInstance(element) && !allowedActions.isEmpty()) { + result.setAction(allowedActions.iterator().next()); + } + return result; + } + + @SuppressWarnings("unchecked") + protected ImportSpec<E> getImportSpec(Element element) { + ImportSpec<E> result = importSpecs.get(element); + if (result == null) { + result = createImportSpec(element); + importSpecs.put((E) element, result); + } + return result; + } + + @SuppressWarnings("unchecked") + protected ImportSpec<E> getImportSpec(Widget item) { + return (ImportSpec<E>) item.getData(); + } + + protected <T extends E> Iterator<T> getAllElementsOfType(final Class<T> type) { + return filter(EcoreUtil.getAllContents(packages), type); + + } + + private <T> Iterator<T> filter(final Iterator<?> iterator, final Class<T> type) { + return new Iterator<T>() { + + private final Iterator<?> delegate = iterator; + + private T next; + + public boolean hasNext() { + if (next == null) { + while (delegate.hasNext()) { + Object next = delegate.next(); + if (type.isInstance(next)) { + this.next = type.cast(next); + break; + } + } + } + + return next != null; + } + + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + + T result = next; + next = null; + return result; + } + + public void remove() { + throw new UnsupportedOperationException("remove"); + } + }; + } + + protected <T extends E> Iterator<T> getRootElementsOfType(final Class<T> type) { + return filter(packages.iterator(), type); + } + + protected void selectAll(ImportAction action) { + Iterator<E> iter; + + // if we propagate selections to children, then we need to cover the + // entire tree. Otherwise, we process only the root packages because + // the nested packages are imported/copied recursively + if ((action == ImportAction.NONE) || subSelection) { + iter = getAllElementsOfType(elementType); + } else { + // first, clear selection of any nested packages + selectAll(ImportAction.NONE); + iter = getRootElementsOfType(elementType); + } + + while (iter.hasNext()) { + ImportSpec<E> importSpec = getImportSpec(iter.next()); + if (action == ImportAction.NONE) { + if (elementTree.getChecked(importSpec)) { + elementTree.setChecked(importSpec, false); + removeResult(importSpec); + } + } else { + if (!elementTree.getChecked(importSpec)) { + elementTree.setChecked(importSpec, true); + addResult(importSpec); + } + importSpec.setAction(action); + } + elementTree.update(importSpec, null); + } + } + + protected void addResult(ImportSpec<E> importSpec) { + if (!elementsToImport.contains(importSpec)) { + elementsToImport.add(importSpec); + } + if (subSelection) { + addChildSelection(importSpec); + } + } + + protected void removeResult(ImportSpec<E> importSpec) { + // bug fix when list is already initialized, it can have several instance of the same element + while (elementsToImport.contains(importSpec)) { + elementsToImport.remove(importSpec); + } + if (subSelection) { + remChildSelection(importSpec); + } + } + + // + // Nested types + // + + public static class ImportSpec<E extends Element> { + + private final E element; + + private ImportAction action = ImportAction.NONE; + + protected ImportSpec(E element) { + this.element = element; + } + + public E getElement() { + return element; + } + + public ImportAction getAction() { + return action; + } + + public void setAction(ImportAction action) { + this.action = (action == null) ? ImportAction.NONE : action; + } + + @Override + public String toString() { + return String.format("<%s> %s", action, element); + } + } + + /** + * Enumeration of the possible actions to apply to an element that is + * selected for import. + */ + public static enum ImportAction { + /** Do not import the element. */ + NONE, + /** Loads the resource */ + LOAD, + /** Import the element or package. */ + IMPORT, + /** Apply the profile (only applicable to profiles). */ + APPLY, + /** Copy the element or package. */ + COPY; + } + + private class ElementTreeContentProvider implements ITreeContentProvider { + + public Object[] getElements(Object inputElement) { + List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>(packages.size()); + + for (Package next : packages) { + result.add(getImportSpec(next)); + } + + return result.toArray(); + } + + public Object[] getChildren(Object parentElement) { + List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>(); + + Element parent = ((ImportSpec<?>) parentElement).getElement(); + if (parent instanceof Package) { + for (Element next : ElementImportTreeSelectionDialog.this.getChildren((Package) parent)) { + + result.add(getImportSpec(next)); + } + } + + return result.toArray(); + } + + public boolean hasChildren(Object element) { + Element parent = ((ImportSpec<?>) element).getElement(); + return parent instanceof Package; + } + + public Object getParent(Object element) { + ImportSpec<?> result = null; + + ImportSpec<?> importSpec = (ImportSpec<?>) element; + Element parent = ((Element) importSpec.getElement()).getOwner(); + + if ((parent != null) && (importSpecs.containsKey(parent))) { + result = importSpecs.get(parent); + } + + return result; + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // pass + } + + public void dispose() { + // pass + } + } + + private class ImportActionEditingSupport extends EditingSupport { + + private ComboBoxViewerCellEditor editor; + + public ImportActionEditingSupport(ColumnViewer viewer) { + super(viewer); + } + + @Override + protected CellEditor getCellEditor(Object element) { + if (editor == null) { + editor = new ComboBoxViewerCellEditor((Tree) getViewer().getControl(), SWT.BORDER); + editor.setLabelProvider(new LabelProvider() { + + @Override + public String getText(Object element) { + return getDisplayName((ImportAction) element); + } + }); + editor.setContentProvider(ArrayContentProvider.getInstance()); + editor.setInput(allowedActions); + } + + return editor; + } + + @Override + protected boolean canEdit(Object element) { + // can't import elements of the wrong type + ImportSpec<?> spec = (ImportSpec<?>) element; + return elementType.isInstance(spec.getElement()); + } + + @Override + protected Object getValue(Object element) { + ImportSpec<?> spec = (ImportSpec<?>) element; + + return elementType.isInstance(spec.getElement()) ? spec.getAction() : ImportAction.NONE; + } + + @Override + protected void setValue(final Object element, Object value) { + @SuppressWarnings("unchecked") + ImportSpec<E> importSpec = (ImportSpec<E>) element; + importSpec.setAction((ImportAction) value); + + // if the user is setting the import action, he wants it imported + if (!elementTree.getChecked(importSpec)) { + elementTree.setChecked(importSpec, true); + addResult(importSpec); + } + + editor.getControl().getDisplay().asyncExec(new Runnable() { + + public void run() { + elementTree.update(element, null); + } + }); + } + + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/items/EnumerationItems.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/items/EnumerationItems.java index feba2424f91..1b84f57f658 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/items/EnumerationItems.java +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/items/EnumerationItems.java @@ -10,6 +10,7 @@ * Contributors: * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.profile.ui.items; @@ -17,6 +18,7 @@ package org.eclipse.papyrus.uml.profile.ui.items; import java.util.List; import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.Message; import org.eclipse.papyrus.uml.profile.utils.Util; import org.eclipse.swt.SWT; @@ -97,7 +99,7 @@ public class EnumerationItems { if (eLiteral != null) { // Prepare Item label TableItem propValueItem = new TableItem(table, SWT.NONE); - propValueItem.setText(eLiteral.getName()); + propValueItem.setText(UMLLabelInternationalization.getInstance().getLabel(eLiteral)); propValueItem.setData(eLiteral); } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/utils/Util.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/utils/Util.java index bacebf7dd49..110a3c311b6 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/utils/Util.java +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/utils/Util.java @@ -11,6 +11,7 @@ * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - add getNearestProfileApplication + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation *****************************************************************************/ package org.eclipse.papyrus.uml.profile.utils; @@ -25,6 +26,7 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.Activator; import org.eclipse.papyrus.uml.profile.Message; import org.eclipse.papyrus.uml.tools.profile.definition.IPapyrusVersionConstants; @@ -134,7 +136,7 @@ public class Util { if (object instanceof Comment) { cName = cComLabel; } else if (cNE != null) { - cName = cNE.getName(); + cName = UMLLabelInternationalization.getInstance().getLabel(cNE); } } else { if (object instanceof Comment) { diff --git a/plugins/uml/pom.xml b/plugins/uml/pom.xml index ed3f292d6c2..99ec962cd5f 100644 --- a/plugins/uml/pom.xml +++ b/plugins/uml/pom.xml @@ -48,5 +48,6 @@ <module>textedit</module> <module>tools</module> <module>xtext</module> + <module>internationalization</module> </modules> </project> diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF index 8eaae96f78f..c3495b5522a 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.7.0,2.0 org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)", org.eclipse.core.databinding.beans;bundle-version="[1.3.0,2.0.0)", org.eclipse.jface.databinding;bundle-version="[1.8.0,2.0.0)", - com.ibm.icu + com.ibm.icu, + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.profile.drafter, org.eclipse.papyrus.uml.profile.drafter.exceptions, org.eclipse.papyrus.uml.profile.drafter.ui.handler, diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java index d8e1c7e1d30..6cad7e38a12 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java @@ -1,93 +1,95 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter;
-
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.ProfileApplication;
-import org.eclipse.uml2.uml.Stereotype;
-
-import com.google.common.base.Function;
-
-
-/**
- * Set of utilities {@link Function} for collections of {@link Profile}.
- *
- * @author cedric dumoulin
- *
- */
-public class ProfileFunctions {
-
- public static ProfileFunctions INSTANCE = new ProfileFunctions();
-
- public static Function<ProfileApplication, Profile> PROFILE_APPLICATION_GETAPPLIEDPROFILE = INSTANCE.new ProfileApplicationProfile();
- public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_NAME = INSTANCE.new ProfileApplicationProfileName();
- public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_QUALIFIEDNAME = INSTANCE.new ProfileApplicationProfileQualifiedName();
- public static Function<Stereotype, String> STEROTYPE_NAME = INSTANCE.new StereotypeName();
- public static Function<Stereotype, String> STEROTYPE_QUALIFIEDNAME = INSTANCE.new StereotypeQualifiedName();
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfile implements Function<ProfileApplication, Profile> {
-
- public Profile apply(ProfileApplication input) {
- return input.getAppliedProfile();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfileName implements Function<ProfileApplication, String> {
-
- public String apply(ProfileApplication input) {
- return input.getAppliedProfile().getName();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfileQualifiedName implements Function<ProfileApplication, String> {
-
- public String apply(ProfileApplication input) {
- return input.getAppliedProfile().getQualifiedName();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class StereotypeName implements Function<Stereotype, String> {
-
- public String apply(Stereotype input) {
- return input.getName();
- };
- }
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class StereotypeQualifiedName implements Function<Stereotype, String> {
-
- public String apply(Stereotype input) {
- return input.getQualifiedName();
- };
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.ProfileApplication; +import org.eclipse.uml2.uml.Stereotype; + +import com.google.common.base.Function; + + +/** + * Set of utilities {@link Function} for collections of {@link Profile}. + * + * @author cedric dumoulin + * + */ +public class ProfileFunctions { + + public static ProfileFunctions INSTANCE = new ProfileFunctions(); + + public static Function<ProfileApplication, Profile> PROFILE_APPLICATION_GETAPPLIEDPROFILE = INSTANCE.new ProfileApplicationProfile(); + public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_NAME = INSTANCE.new ProfileApplicationProfileName(); + public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_QUALIFIEDNAME = INSTANCE.new ProfileApplicationProfileQualifiedName(); + public static Function<Stereotype, String> STEROTYPE_NAME = INSTANCE.new StereotypeName(); + public static Function<Stereotype, String> STEROTYPE_QUALIFIEDNAME = INSTANCE.new StereotypeQualifiedName(); + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfile implements Function<ProfileApplication, Profile> { + + public Profile apply(ProfileApplication input) { + return input.getAppliedProfile(); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfileName implements Function<ProfileApplication, String> { + + public String apply(ProfileApplication input) { + return UMLLabelInternationalization.getInstance().getLabel(input.getAppliedProfile()); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfileQualifiedName implements Function<ProfileApplication, String> { + + public String apply(ProfileApplication input) { + return input.getAppliedProfile().getQualifiedName(); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class StereotypeName implements Function<Stereotype, String> { + + public String apply(Stereotype input) { + return UMLLabelInternationalization.getInstance().getKeyword(input); + }; + } + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class StereotypeQualifiedName implements Function<Stereotype, String> { + + public String apply(Stereotype input) { + return input.getQualifiedName(); + }; + } +} diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java index 2a17a76f44b..6dd567e9843 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java @@ -1,86 +1,88 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter.ui.contentassist;
-
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.uml2.uml.Stereotype;
-
-
-/**
- * Field assist {@link IContentProposal} .
- * This implementation is used to render one proposal of a {@link Stereotype}
- *
- * @author cedric dumoulin
- *
- */
-public class StereotypeContentProvider implements IContentProposal, Comparable<StereotypeContentProvider> {
-
- /**
- * The stereotype that is render.
- */
- private Stereotype stereotype;
-
-
- /**
- * Constructor.
- *
- * @param stereotype
- */
- public StereotypeContentProvider(Stereotype stereotype) {
- this.stereotype = stereotype;
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getContent()
- *
- * @return
- */
- public String getContent() {
- return stereotype.getName();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getCursorPosition()
- *
- * @return
- */
- public int getCursorPosition() {
- return getLabel().length();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getLabel()
- *
- * @return
- */
- public String getLabel() {
- return stereotype.getName();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getDescription()
- *
- * @return
- */
- public String getDescription() {
- // TODO Auto-generated method stub
- return stereotype.getKeyword();
- }
-
- public int compareTo(StereotypeContentProvider o) {
- return this.getLabel().compareTo(o.getLabel());
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter.ui.contentassist; + +import org.eclipse.jface.fieldassist.IContentProposal; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Stereotype; + + +/** + * Field assist {@link IContentProposal} . + * This implementation is used to render one proposal of a {@link Stereotype} + * + * @author cedric dumoulin + * + */ +public class StereotypeContentProvider implements IContentProposal, Comparable<StereotypeContentProvider> { + + /** + * The stereotype that is render. + */ + private Stereotype stereotype; + + + /** + * Constructor. + * + * @param stereotype + */ + public StereotypeContentProvider(Stereotype stereotype) { + this.stereotype = stereotype; + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getContent() + * + * @return + */ + public String getContent() { + return UMLLabelInternationalization.getInstance().getKeyword(stereotype); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getCursorPosition() + * + * @return + */ + public int getCursorPosition() { + return getLabel().length(); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getLabel() + * + * @return + */ + public String getLabel() { + return UMLLabelInternationalization.getInstance().getKeyword(stereotype); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getDescription() + * + * @return + */ + public String getDescription() { + // TODO Auto-generated method stub + return stereotype.getKeyword(); + } + + public int compareTo(StereotypeContentProvider o) { + return this.getLabel().compareTo(o.getLabel()); + } + +} diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java index 762c1bbce9d..e02ae90964c 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java @@ -1,3 +1,16 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA List and Others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.profile.drafter.ui.dialog; import java.util.List; @@ -31,6 +44,7 @@ import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.drafter.ui.model.AccessibleTypeCatalog; import org.eclipse.papyrus.uml.profile.drafter.ui.model.ITypeCatalog; import org.eclipse.papyrus.uml.profile.drafter.ui.model.MemberKind; @@ -327,7 +341,7 @@ public class PropertiesEditorWidget { public String getText(Object element) { Property property = (Property)element; - return property.getName(); + return UMLLabelInternationalization.getInstance().getLabel(property); } } @@ -344,7 +358,7 @@ public class PropertiesEditorWidget { Object value = selectedElement.getValue((Stereotype)property.getOwner(), property.getName()); if(value instanceof NamedElement) { - return ((NamedElement)value).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement)value)); } // TODO // collections and arrays diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java index 45d2db0b338..6d9a13103e3 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java @@ -1,3 +1,16 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA List and Others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.profile.drafter.ui.dialog; import org.eclipse.jface.viewers.ColumnLabelProvider; @@ -5,6 +18,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -146,7 +160,7 @@ public class TaggedValuesEditorWidget { public String getText(Object element) { Property property = (Property)element; - return property.getName(); + return UMLLabelInternationalization.getInstance().getLabel(property); } } @@ -163,7 +177,7 @@ public class TaggedValuesEditorWidget { Object value = selectedElement.getValue((Stereotype)property.getOwner(), property.getName()); if(value instanceof NamedElement) { - return ((NamedElement)value).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement)value)); } // TODO // collections and arrays diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java index db8350cb357..2d2066b37c0 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java @@ -1,38 +1,40 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter.ui.providers;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.uml2.uml.Type;
-
-
-/**
- * A {@link ILabelProvider} for uml {@link Type}
- * @author cedric dumoulin
- *
- */
-public class TypeLabelProvider extends LabelProvider {
-
-
- @Override
- public String getText(Object element) {
- if(element instanceof Type) {
- return ((Type)element).getName();
- }
-
- return super.getText(element);
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter.ui.providers; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Type; + + +/** + * A {@link ILabelProvider} for uml {@link Type} + * @author cedric dumoulin + * + */ +public class TypeLabelProvider extends LabelProvider { + + + @Override + public String getText(Object element) { + if(element instanceof Type) { + return UMLLabelInternationalization.getInstance().getLabel((Type)element); + } + + return super.getText(element); + } +} diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF index 579f5b0531a..40775d11efe 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF @@ -31,7 +31,10 @@ Require-Bundle: org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)";v org.eclipse.papyrus.uml.ui;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)", org.eclipse.jface;bundle-version="[3.12.0,4.0.0)", - org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.papyrus.uml.properties.constraints" Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt index c52c123b364..17227a38210 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:EnumCombo input="{Binding}" property="MemberEnd:owner"></ppe:EnumCombo> <ppe:BooleanRadio input="{Binding}" property="MemberEnd:navigable"></ppe:BooleanRadio> <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/Metaclass.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/Metaclass.xwt index 76065f9afbd..d76e757fb28 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/Metaclass.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/Metaclass.xwt @@ -7,6 +7,7 @@ </Composite.layout> <ppe:StringEditor property="UML:NamedElement:name" input="{Binding}"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor property="UML:NamedElement:qualifiedName" input="{Binding}"></ppe:StringEditor> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAbstraction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAbstraction.xwt index 3b0a20cc387..767bcdd17df 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAbstraction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAbstraction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptCallAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptCallAction.xwt index 513227e1158..c61b2da1577 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptCallAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptCallAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptEventAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptEventAction.xwt index 9078b217b10..e4e8af0b7e6 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptEventAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAcceptEventAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAction.xwt index d6c38f1811f..be4981c26f7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionExecutionSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionExecutionSpecification.xwt index 37ec619895d..c9b2fd70767 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionExecutionSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionExecutionSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt index 4a91610f627..e5c4c7f6f8a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivity.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivity.xwt index 51af90720d3..96352a148e1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivity.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivity.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityEdge.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityEdge.xwt index c8f2f4512a7..48f23902a17 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityEdge.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityEdge.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityFinalNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityFinalNode.xwt index ab2745e74d5..6f584d0d597 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityFinalNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityFinalNode.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityNode.xwt index baec30ebcb4..a013f49d939 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityParameterNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityParameterNode.xwt index da13d21ba87..c127b368cfd 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityParameterNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityParameterNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityPartition.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityPartition.xwt index 66d27fb7c03..2e4e34ac2d5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityPartition.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActivityPartition.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActor.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActor.xwt index bc83414353a..04aff861040 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActor.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActor.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddStructuralFeatureValueAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddStructuralFeatureValueAction.xwt index 662844c745e..2871528e036 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddStructuralFeatureValueAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddStructuralFeatureValueAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddVariableValueAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddVariableValueAction.xwt index 66e47d625ec..e85c2e3460c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddVariableValueAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAddVariableValueAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAnyReceiveEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAnyReceiveEvent.xwt index 0526e9b5db6..e2a53d39741 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAnyReceiveEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAnyReceiveEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleArtifact.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleArtifact.xwt index 3efb9ccd5ba..b8f2a401897 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleArtifact.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleArtifact.xwt @@ -11,6 +11,7 @@ </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:Artifact:fileName"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociation.xwt index 921fffebee5..718a1ed79ee 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociation.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo> <ppe:ViewEditor numColumns="2" input="{Binding}" view="UML:MemberEnd" property="UML:Association:memberEnd"></ppe:ViewEditor> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociationClass.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociationClass.xwt index 95b110a91f1..54f47f39a88 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociationClass.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleAssociationClass.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavior.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavior.xwt index fcbc45cb500..d491772db0b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavior.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavior.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehaviorExecutionSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehaviorExecutionSpecification.xwt index c16de051ef3..8847b641e48 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehaviorExecutionSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehaviorExecutionSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioralFeature.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioralFeature.xwt index c90efc5e19e..a2c0d280411 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioralFeature.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioralFeature.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioredClassifier.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioredClassifier.xwt index 4b432fa28a6..383bffc6ece 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioredClassifier.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBehavioredClassifier.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBroadcastSignalAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBroadcastSignalAction.xwt index 63bb343a4bc..4ecf3283b87 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBroadcastSignalAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleBroadcastSignalAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallAction.xwt index dd834f74f49..40a407c230f 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallBehaviorAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallBehaviorAction.xwt index af8e4a46e8a..2dbdf3e6a36 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallBehaviorAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallBehaviorAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallEvent.xwt index 81c7a697ace..d1034967a3c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallOperationAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallOperationAction.xwt index f5767909efc..41936241598 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallOperationAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCallOperationAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCentralBufferNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCentralBufferNode.xwt index a9234f9d012..63a708b33b4 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCentralBufferNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCentralBufferNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleChangeEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleChangeEvent.xwt index 6361a76d9c0..b8f1ed918fe 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleChangeEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleChangeEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClass.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClass.xwt index f4f06590190..749b368d55b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClass.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClass.xwt @@ -13,6 +13,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:qualifiedName"></ppe:StringEditor> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClassifier.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClassifier.xwt index aea6c5582a7..3e112ceba78 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClassifier.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClassifier.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearAssociationAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearAssociationAction.xwt index 71fc75223ba..ce0d18aa866 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearAssociationAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearAssociationAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearStructuralFeatureAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearStructuralFeatureAction.xwt index 06d277e8d29..0bd3a24ce5c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearStructuralFeatureAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearStructuralFeatureAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearVariableAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearVariableAction.xwt index 849dd3fec75..72bc0751c90 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearVariableAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleClearVariableAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaboration.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaboration.xwt index 81e55858ef6..17ffc60b2cc 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaboration.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaboration.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaborationUse.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaborationUse.xwt index e38231f4f34..81338550512 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaborationUse.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCollaborationUse.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCombinedFragment.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCombinedFragment.xwt index c980d965960..3dc47534524 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCombinedFragment.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCombinedFragment.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCommunicationPath.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCommunicationPath.xwt index 334faffcb4d..bda8f75cbec 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCommunicationPath.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCommunicationPath.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponent.xwt index 92bfd0f5ddc..3bf0b9b633d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponentRealization.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponentRealization.xwt index 55e51f64679..0c9e4e7ff33 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponentRealization.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleComponentRealization.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConditionalNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConditionalNode.xwt index 3cfba767c6b..27dc4673ca5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConditionalNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConditionalNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectableElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectableElement.xwt index 2b8851d970e..ff869ea2ad3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectableElement.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectableElement.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectionPointReference.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectionPointReference.xwt index bf0c1320b42..84c1376bb82 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectionPointReference.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectionPointReference.xwt @@ -10,5 +10,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnector.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnector.xwt index ae4d74c81d2..b9df5e2b6f1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnector.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnector.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConsiderIgnoreFragment.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConsiderIgnoreFragment.xwt index 8532049a3a2..b941c4b138c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConsiderIgnoreFragment.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConsiderIgnoreFragment.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConstraint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConstraint.xwt index d285a8849cc..97ecb4b435e 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConstraint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConstraint.xwt @@ -17,6 +17,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo> <ppe:ReferenceDialog input="{Binding}" property="UML:Constraint:context"></ppe:ReferenceDialog> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleContinuation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleContinuation.xwt index 0d0675bafc7..89f62c2d283 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleContinuation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleContinuation.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlFlow.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlFlow.xwt index 1c545c71863..37b92db9c55 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlFlow.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlFlow.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlNode.xwt index 255ad15f9ea..855843bf2f8 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleControlNode.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkAction.xwt index c21bd7df690..925eaee80a0 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkObjectAction.xwt index fbf7cabda9a..a15972f5f9c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateLinkObjectAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateObjectAction.xwt index 3a2fd8aa824..5f1c5554f25 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreateObjectAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreationEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreationEvent.xwt index c86e550d68b..14902ad0fe0 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreationEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleCreationEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataStoreNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataStoreNode.xwt index b138c63c5c1..97e49ccc4a6 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataStoreNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataStoreNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataType.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataType.xwt index 062f797c4d3..ca6add38b15 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataType.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDataType.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDecisionNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDecisionNode.xwt index d8c947c7fa5..daf7278a1c3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDecisionNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDecisionNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDependency.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDependency.xwt index dcb7cc4d428..5006218a40a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDependency.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDependency.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployedArtifact.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployedArtifact.xwt index 23c784e8d0e..f32d9a03fc1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployedArtifact.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployedArtifact.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployment.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployment.xwt index 45510afd6e3..b29977684de 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployment.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeployment.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentSpecification.xwt index dd322facbb1..b6c6a3b8e19 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentSpecification.xwt @@ -15,6 +15,7 @@ property="UML:DeploymentSpecification:executionLocation"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:Artifact:fileName"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentTarget.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentTarget.xwt index 79496730d48..1dd743f2103 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentTarget.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDeploymentTarget.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyLinkAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyLinkAction.xwt index 4c82dee44b9..b0c0192293c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyLinkAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyLinkAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyObjectAction.xwt index be1031ff285..f6bfe7c1624 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDestroyObjectAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDevice.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDevice.xwt index a2956c049d1..5d4976fb878 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDevice.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDevice.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDuration.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDuration.xwt index 01057a74536..dd143a29616 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDuration.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDuration.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationConstraint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationConstraint.xwt index ebffbb85e31..d74b3a1327c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationConstraint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationConstraint.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationInterval.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationInterval.xwt index de596598d6e..f21ddfd590d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationInterval.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationInterval.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationObservation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationObservation.xwt index 3eedbb0c64f..d4c58bc1c7f 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationObservation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleDurationObservation.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEncapsulatedClassifier.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEncapsulatedClassifier.xwt index 90b21e55767..3684a955011 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEncapsulatedClassifier.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEncapsulatedClassifier.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumeration.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumeration.xwt index 6a4ac0f31e1..1b2d8c83ae7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumeration.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumeration.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumerationLiteral.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumerationLiteral.xwt index ed524d38462..adbe0f8a565 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumerationLiteral.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEnumerationLiteral.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEvent.xwt index 0526e9b5db6..e2a53d39741 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutableNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutableNode.xwt index f02841a7ee8..65ba9aa8063 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutableNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutableNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionEnvironment.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionEnvironment.xwt index 84013cbdda0..cb9bee1d837 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionEnvironment.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionEnvironment.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionOccurrenceSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionOccurrenceSpecification.xwt index c7bdac53645..3f75e669f90 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionOccurrenceSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionOccurrenceSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionSpecification.xwt index 3c000822daf..6bf1b703d1d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExecutionSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionNode.xwt index dba8a1ceada..ba7c6ef5b96 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionRegion.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionRegion.xwt index 061c0002768..8bd04dc9c31 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionRegion.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpansionRegion.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpression.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpression.xwt index 0a29f4634ab..b704f65f21d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpression.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExpression.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:Expression:symbol"></ppe:StringEditor> </Composite> <Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtend.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtend.xwt index 920b1eaf180..07c7e904611 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtend.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtend.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtension.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtension.xwt index e33e4f0f3bc..e6b7e2efb85 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtension.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtension.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:BooleanRadio input="{Binding}" property="UML:Extension:isRequired"></ppe:BooleanRadio> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionEnd.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionEnd.xwt index fb56151966b..d41e1d51f54 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionEnd.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionEnd.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionPoint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionPoint.xwt index 231ea6e843f..5b666143654 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionPoint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleExtensionPoint.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFeature.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFeature.xwt index 6528a19996d..567feace8de 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFeature.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFeature.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalNode.xwt index ea3ddf5e9d6..a8fb68d60eb 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalNode.xwt @@ -10,5 +10,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalState.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalState.xwt index 7da7a607ca4..0c4faa5935d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalState.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFinalState.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFlowFinalNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFlowFinalNode.xwt index 055f519975c..10b7acb7e62 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFlowFinalNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFlowFinalNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleForkNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleForkNode.xwt index bf0c1320b42..84c1376bb82 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleForkNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleForkNode.xwt @@ -10,5 +10,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFunctionBehavior.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFunctionBehavior.xwt index 133b8405219..f809247c7d7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFunctionBehavior.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleFunctionBehavior.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGate.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGate.xwt index 0526e9b5db6..e2a53d39741 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGate.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGate.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralOrdering.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralOrdering.xwt index 68db0e432cd..5e73f3ed24b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralOrdering.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralOrdering.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralizationSet.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralizationSet.xwt index 2ce1b03bd97..e30db63699f 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralizationSet.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleGeneralizationSet.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInclude.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInclude.xwt index 84b4fce16df..a3ac3f8a7c0 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInclude.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInclude.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationFlow.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationFlow.xwt index 0c52ab30902..6e9a8776867 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationFlow.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationFlow.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationItem.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationItem.xwt index 609ba21e765..87df02640ed 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationItem.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInformationItem.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInitialNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInitialNode.xwt index c53f7e1a1b2..9dd29f20d59 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInitialNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInitialNode.xwt @@ -11,5 +11,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt index 65f3ba18fb2..6e9a15bb197 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceSpecification.xwt index b3640821fd4..2762c5a5892 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceSpecification.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceValue.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceValue.xwt index fc1f83888b5..cde9c2a6af3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceValue.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInstanceValue.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteraction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteraction.xwt index 6bab1673ed9..53ab8de484b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteraction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteraction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionConstraint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionConstraint.xwt index 88f3119ac00..15de3def4f0 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionConstraint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionConstraint.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionFragment.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionFragment.xwt index f0dc467200f..232a8386499 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionFragment.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionFragment.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionOperand.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionOperand.xwt index 7224d6f07db..505d6ad79fe 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionOperand.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionOperand.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionUse.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionUse.xwt index 1edbc6e7224..2e410434f27 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionUse.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInteractionUse.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo> <ppe:ReferenceDialog property="UML:InteractionUse:refersTo" input="{Binding}"></ppe:ReferenceDialog> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterface.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterface.xwt index 4f8c0be2300..a256ba51e47 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterface.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterface.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterfaceRealization.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterfaceRealization.xwt index 4e11b9a8d60..fef8def8674 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterfaceRealization.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterfaceRealization.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterval.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterval.xwt index 02df74709ef..9d10edca305 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterval.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInterval.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleIntervalConstraint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleIntervalConstraint.xwt index 598c3bde20b..872e49af156 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleIntervalConstraint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleIntervalConstraint.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInvocationAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInvocationAction.xwt index a6e6dc5fc9f..7c626b2b246 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInvocationAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInvocationAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleJoinNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleJoinNode.xwt index 2141614809c..0f4bed5ad41 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleJoinNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleJoinNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLifeline.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLifeline.xwt index 0cf7211b94c..030da045ca9 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLifeline.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLifeline.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLinkAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLinkAction.xwt index 8162aac5228..cb62ded97e6 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLinkAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLinkAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralBoolean.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralBoolean.xwt index 121ade1de52..60ba5bc5f6d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralBoolean.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralBoolean.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:BooleanRadio input="{Binding}" property="UML:LiteralBoolean:value"></ppe:BooleanRadio> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralInteger.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralInteger.xwt index 58a0c1166c6..6192536a9a5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralInteger.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralInteger.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:IntegerEditor input="{Binding}" property="UML:LiteralInteger:value"></ppe:IntegerEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralNull.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralNull.xwt index e994c48921f..899225b1fe4 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralNull.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralNull.xwt @@ -11,5 +11,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralSpecification.xwt index bf9d2b61f07..b4f451b3eae 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralString.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralString.xwt index 1e4dfb767be..db662433878 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralString.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralString.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringMultiline input="{Binding}" property="UML:LiteralString:value"></ppe:StringMultiline> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralUnlimitedNatural.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralUnlimitedNatural.xwt index 340332f55ac..0e33d6a524a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralUnlimitedNatural.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLiteralUnlimitedNatural.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:UnlimitedNaturalEditor input="{Binding}" property="UML:LiteralInteger:value"></ppe:UnlimitedNaturalEditor> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLoopNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLoopNode.xwt index 5b66bf5a3fc..a13469b4035 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLoopNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleLoopNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleManifestation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleManifestation.xwt index 41c2394016b..12727d9c5c5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleManifestation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleManifestation.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMergeNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMergeNode.xwt index ef8d3ff86c6..9ae9f1c2a26 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMergeNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMergeNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessage.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessage.xwt index 3064cd2510e..c5ee009da45 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessage.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessage.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEnd.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEnd.xwt index 23c784e8d0e..f32d9a03fc1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEnd.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEnd.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEvent.xwt index a5648c1f885..14c17f521d5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageEvent.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageOccurrenceSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageOccurrenceSpecification.xwt index 50cb4aea377..d993f383da8 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageOccurrenceSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMessageOccurrenceSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleModel.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleModel.xwt index 5032e571ac5..350e05596c1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleModel.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleModel.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor property="UML:Package:URI" input="{Binding}"></ppe:StringEditor> </Composite> <Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamedElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamedElement.xwt index 8fc1ef7cf56..19b34bc47a7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamedElement.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamedElement.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamespace.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamespace.xwt index e0f3899f82d..d6f057cda9a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamespace.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNamespace.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNode.xwt index 4a18a05f495..7316cb81421 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleNode.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectFlow.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectFlow.xwt index 3ee52978078..c2758ce7f90 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectFlow.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectFlow.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectNode.xwt index a0a25b7e144..4c7d74ef6ff 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObjectNode.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObservation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObservation.xwt index 2865915424f..a8bf2837eb5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObservation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleObservation.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOccurrenceSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOccurrenceSpecification.xwt index db5a2a6b13a..b176469f496 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOccurrenceSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOccurrenceSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueAction.xwt index 0a804119d3c..51ae4421305 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueAction.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueBehavior.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueBehavior.xwt index dbbc819fb10..bed152b9d43 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueBehavior.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueBehavior.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueExpression.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueExpression.xwt index 9d35edc747c..eef2d1fb4bd 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueExpression.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOpaqueExpression.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOperation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOperation.xwt index cf8ec2c2572..3f6fc27bbc9 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOperation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOperation.xwt @@ -13,6 +13,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt index 3706efad65a..2a70d984e00 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackage.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackage.xwt index 2db7edfa3c1..cb4db637d1a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackage.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackage.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor property="UML:Package:URI" input="{Binding}"></ppe:StringEditor> </Composite> <Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackageableElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackageableElement.xwt index 1ba077961d6..53afa5b81d3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackageableElement.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePackageableElement.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt index 3bd7f5eeeb0..d2e27b9bbec 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameterSet.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameterSet.xwt index e8d70485ed4..946c5794c6e 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameterSet.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameterSet.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePartDecomposition.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePartDecomposition.xwt index 68db0e432cd..5e73f3ed24b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePartDecomposition.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePartDecomposition.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt index 3eff3bc360e..8655a526d6f 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt index a36d116f84c..0c2fadf1f78 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePrimitiveType.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePrimitiveType.xwt index d999a1504fe..c8779d7c102 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePrimitiveType.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePrimitiveType.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProfile.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProfile.xwt index 502379149f0..bd5915444c7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProfile.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProfile.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor property="UML:Package:URI" input="{Binding}"></ppe:StringEditor> </Composite> <Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt index 4ba6755ae36..09680041166 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt @@ -13,6 +13,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolStateMachine.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolStateMachine.xwt index 3cf7c7e2452..9bc24cc4dc0 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolStateMachine.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolStateMachine.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolTransition.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolTransition.xwt index c1c14a41bb3..c2a7bf45819 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolTransition.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProtocolTransition.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePseudostate.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePseudostate.xwt index 6070c1f7809..ba72ffe752b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePseudostate.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePseudostate.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRaiseExceptionAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRaiseExceptionAction.xwt index 945fdd7e2f9..9a3ec28664b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRaiseExceptionAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRaiseExceptionAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadExtentAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadExtentAction.xwt index b329040949d..849be233162 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadExtentAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadExtentAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadIsClassifiedObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadIsClassifiedObjectAction.xwt index 3982dfff5b2..a2e45db7ee8 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadIsClassifiedObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadIsClassifiedObjectAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkAction.xwt index c487cd86fb6..6eb5d90259d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndAction.xwt index ea6aa149e5b..f83dcc6dddb 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndQualifierAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndQualifierAction.xwt index 80d59564d83..11e385d79a3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndQualifierAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadLinkObjectEndQualifierAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadSelfAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadSelfAction.xwt index 6243966b98c..8e911adaa41 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadSelfAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadSelfAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadStructuralFeatureAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadStructuralFeatureAction.xwt index 07deb3f748e..4206771ecf8 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadStructuralFeatureAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadStructuralFeatureAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadVariableAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadVariableAction.xwt index bf6ccbae49a..5d396b68462 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadVariableAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReadVariableAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealLiteral.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealLiteral.xwt index dd1137f21b1..419a3d8a9d7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealLiteral.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealLiteral.xwt @@ -7,5 +7,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:DoubleEditor input="{Binding}" property="UML:LiteralReal:value"></ppe:DoubleEditor> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealization.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealization.xwt index 75a02190765..7f203774a7c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealization.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRealization.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReception.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReception.xwt index 230dee3d656..e292cf786c1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReception.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReception.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReclassifyObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReclassifyObjectAction.xwt index 33234465ae2..9e58a670ec3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReclassifyObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReclassifyObjectAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableElement.xwt index 6ca4d336e10..b3ba87f770b 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableElement.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableElement.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableTemplateSignature.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableTemplateSignature.xwt index f2957f99387..6edf96a8e26 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableTemplateSignature.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRedefinableTemplateSignature.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReduceAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReduceAction.xwt index b3b5809524d..395c1deae7e 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReduceAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReduceAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRegion.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRegion.xwt index 2a0bb0ddf1b..befc9dbf067 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRegion.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRegion.xwt @@ -10,5 +10,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> </Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveStructuralFeatureValueAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveStructuralFeatureValueAction.xwt index 146a12af43c..d2162d45e55 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveStructuralFeatureValueAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveStructuralFeatureValueAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveVariableValueAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveVariableValueAction.xwt index 1200f1497ee..eb4deef3e6a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveVariableValueAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleRemoveVariableValueAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReplyAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReplyAction.xwt index a55b87b442f..592346a2791 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReplyAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleReplyAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendObjectAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendObjectAction.xwt index ea0b583579c..3c514548dab 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendObjectAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendObjectAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendSignalAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendSignalAction.xwt index c1000b25263..d360bc4dbc3 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendSignalAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSendSignalAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSequenceNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSequenceNode.xwt index de302fed7f9..58ad0bdaf3d 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSequenceNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSequenceNode.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignal.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignal.xwt index 6e8e5a09b32..b3fa86410e1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignal.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignal.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignalEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignalEvent.xwt index ae2e6ceedd2..edbc2d078e6 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignalEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSignalEvent.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartClassifierBehaviorAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartClassifierBehaviorAction.xwt index a1d0bc60f3a..f6a85618a0a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartClassifierBehaviorAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartClassifierBehaviorAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartObjectBehaviorAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartObjectBehaviorAction.xwt index 9bf537b418a..194fcefd5fc 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartObjectBehaviorAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStartObjectBehaviorAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleState.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleState.xwt index 5a86d2681cd..5de4f6f2ccc 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleState.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleState.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateInvariant.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateInvariant.xwt index 554be6517a5..f8b4ef4a95a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateInvariant.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateInvariant.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateMachine.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateMachine.xwt index b765be3b6c6..61e5bb57ff5 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateMachine.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStateMachine.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStereotype.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStereotype.xwt index fd04604c3e7..98453e52520 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStereotype.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStereotype.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:Stereotype:keyword"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStringExpression.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStringExpression.xwt index 34284d86217..bd2c3b3f069 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStringExpression.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStringExpression.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:StringEditor input="{Binding}" property="UML:Expression:symbol"></ppe:StringEditor> </Composite> <Composite> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt index 1005f1c2d47..8d36240cf77 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeatureAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeatureAction.xwt index cfaca675f24..9e2888c0bba 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeatureAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeatureAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredActivityNode.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredActivityNode.xwt index 87f5fe51a3f..3446c2c40f1 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredActivityNode.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredActivityNode.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredClassifier.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredClassifier.xwt index c6709efc8fd..1969afd0266 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredClassifier.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuredClassifier.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSubstitution.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSubstitution.xwt index 52fa34359b4..f4c533351af 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSubstitution.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleSubstitution.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTestIdentityAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTestIdentityAction.xwt index 7ea4be9088c..3666627ac04 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTestIdentityAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTestIdentityAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeConstraint.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeConstraint.xwt index ada4946e586..56ac23cd10c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeConstraint.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeConstraint.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeEvent.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeEvent.xwt index e8b28df8ba5..7f169946995 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeEvent.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeEvent.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeExpression.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeExpression.xwt index a509283455b..49466ed4c9e 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeExpression.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeExpression.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeInterval.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeInterval.xwt index 7e3be996d58..3f0bb674a65 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeInterval.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeInterval.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeObservation.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeObservation.xwt index 806597655e6..2923d9ee838 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeObservation.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTimeObservation.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTransition.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTransition.xwt index 0b799bec4ea..5213b119fb9 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTransition.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTransition.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTrigger.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTrigger.xwt index 12a11e3cd5a..5f6f1b3fe33 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTrigger.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTrigger.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo> <ppe:ReferenceDialog input="{Binding}" property="UML:Trigger:event"></ppe:ReferenceDialog> <ppe:MultiReference property="UML:Trigger:port" diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleType.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleType.xwt index 2cc129fbbc7..65199666137 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleType.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleType.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTypedElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTypedElement.xwt index e072a510eae..45b554c71af 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTypedElement.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleTypedElement.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUnmarshallAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUnmarshallAction.xwt index 3a832dea5c4..448bb24a3eb 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUnmarshallAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUnmarshallAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUsage.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUsage.xwt index fb46bbd0dc9..14b775a5f6c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUsage.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUsage.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUseCase.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUseCase.xwt index d85175b1994..66e19332d88 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUseCase.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleUseCase.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt index e75a768a67d..2d3dd380734 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecification.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecification.xwt index 3319f908874..46cb44f0fda 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecification.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecification.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecificationAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecificationAction.xwt index 6e36b287eb0..e475f2a0163 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecificationAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValueSpecificationAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt index 347b5cef761..52814d74e7e 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt @@ -12,6 +12,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariableAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariableAction.xwt index 1dd55287b40..1baeb018081 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariableAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariableAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVertex.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVertex.xwt index 29ee7943e7d..ea304be0ae8 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVertex.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVertex.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteLinkAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteLinkAction.xwt index fdfed6a3527..8f85cdf8ed7 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteLinkAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteLinkAction.xwt @@ -11,6 +11,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteStructuralFeatureAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteStructuralFeatureAction.xwt index 29e4c477d9d..190f0e00031 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteStructuralFeatureAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteStructuralFeatureAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteVariableAction.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteVariableAction.xwt index f816f2cf19d..c60df8aff93 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteVariableAction.xwt +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleWriteVariableAction.xwt @@ -10,6 +10,7 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UML:NamedElement:label"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/KeywordObservableValue.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/KeywordObservableValue.java new file mode 100644 index 00000000000..6eb429731d4 --- /dev/null +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/KeywordObservableValue.java @@ -0,0 +1,148 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.properties.databinding; + +import org.eclipse.core.databinding.observable.IObserving; +import org.eclipse.core.databinding.observable.Realm; +import org.eclipse.core.databinding.observable.value.AbstractObservableValue; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.properties.Activator; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * + */ +public class KeywordObservableValue extends AbstractObservableValue implements IObserving, ReferenceCountedObservable { + + private final ReferenceCountedObservable.Support refCount = new ReferenceCountedObservable.Support(this); + + /** + * The object instance. + */ + protected Stereotype stereotype; + + /** + * The editing domain on which the commands will be executed. + */ + protected EditingDomain domain; + + /** + * Constructor. + * + * @param eObject The object. + * @param domain The editing domain. + */ + public KeywordObservableValue(final Stereotype stereotype, final EditingDomain domain) { + this(Realm.getDefault(), stereotype, domain); + } + + /** + * Constructor. + * + * @param realm The current Realm. + * @param eObject The object. + * @param domain The editing domain. + */ + public KeywordObservableValue(final Realm realm, final Stereotype stereotype, final EditingDomain domain) { + super(realm); + this.stereotype = stereotype; + this.domain = domain; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.AbstractObservable#dispose() + */ + @Override + public synchronized void dispose() { + stereotype = null; + super.dispose(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.IObserving#getObserved() + */ + public Object getObserved(){ + return stereotype; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + */ + @Override + protected Object doGetValue(){ + return UMLLabelInternationalization.getInstance().getKeywordWithoutUML(stereotype); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + */ + @Override + protected void doSetValue(Object value) { + try { + Command emfCommand = UMLLabelInternationalization.getInstance().getSetKeywordCommand(domain, stereotype, (String) value, null); + domain.getCommandStack().execute(emfCommand); + } catch (Exception ex) { + Activator.log.error(ex); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + */ + public Object getValueType() { + return UMLPackage.eINSTANCE.getNamedElement__GetLabel(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#retain() + */ + public void retain() { + refCount.retain(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#release() + */ + public void release() { + refCount.release(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#autorelease() + */ + public void autorelease() { + refCount.autorelease(); + } + +} diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/UMLLabelObservableValue.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/UMLLabelObservableValue.java new file mode 100644 index 00000000000..796c7b995d5 --- /dev/null +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/UMLLabelObservableValue.java @@ -0,0 +1,220 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.properties.databinding; + +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.core.databinding.observable.IObserving; +import org.eclipse.core.databinding.observable.Realm; +import org.eclipse.core.databinding.observable.value.AbstractObservableValue; +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry; +import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage; +import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; +import org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.properties.Activator; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * The observable value for the label of the {@link NamedElement}. + */ +@SuppressWarnings("rawtypes") +public class UMLLabelObservableValue extends AbstractObservableValue implements IObserving, ReferenceCountedObservable { + + /** + * The support reference counting on behalf of an {@code observable}. + */ + private final ReferenceCountedObservable.Support refCount = new ReferenceCountedObservable.Support(this); + + /** + * The object instance. + */ + protected NamedElement namedElement; + + /** + * The editing domain on which the commands will be executed. + */ + protected EditingDomain domain; + + /** + * The listener for the entry modification. + */ + protected Adapter listener; + + /** + * The internationalization entry corresponding to the named element. + */ + protected InternationalizationEntry entry; + + /** + * Constructor. + * + * @param eObject + * The object. + * @param domain + * The editing domain. + */ + public UMLLabelObservableValue(final NamedElement namedElement, final EditingDomain domain) { + this(Realm.getDefault(), namedElement, domain); + } + + /** + * Constructor. + * + * @param realm + * The current Realm. + * @param eObject + * The object. + * @param domain + * The editing domain. + */ + public UMLLabelObservableValue(final Realm realm, final NamedElement namedElement, final EditingDomain domain) { + super(realm); + this.namedElement = namedElement; + this.domain = domain; + this.entry = LabelInternationalizationUtils.getInternationalizationEntry(namedElement, namedElement); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.AbstractObservable#dispose() + */ + @Override + public synchronized void dispose() { + if (null != listener) { + entry.eAdapters().remove(listener); + listener = null; + } + + entry = null; + namedElement = null; + super.dispose(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.IObserving#getObserved() + */ + public Object getObserved() { + return namedElement; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.ChangeManager#firstListenerAdded() + */ + @Override + protected void firstListenerAdded() { + if (null != entry) { + if(null == listener){ + listener = new AdapterImpl() { + @Override + public void notifyChanged(Notification notification) { + if (InternationalizationPackage.eINSTANCE.getInternationalizationEntry_Value() == notification.getFeature() && !notification.isTouch()) { + final ValueDiff diff = Diffs.createValueDiff(notification.getOldValue(), notification.getNewValue()); + getRealm().exec(new Runnable() { + @SuppressWarnings("unchecked") + public void run() { + fireValueChange(diff); + } + }); + } + } + }; + } + entry.eAdapters().add(listener); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + */ + @Override + protected Object doGetValue() { + return UMLLabelInternationalization.getInstance().getLabelWithoutUML(namedElement); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + */ + @Override + protected void doSetValue(final Object value) { + try { + + // Remove the listener on entry + if(null != entry && null != listener){ + entry.eAdapters().remove(listener); + } + + final Command emfCommand = UMLLabelInternationalization.getInstance().getSetLabelCommand(domain, namedElement, (String) value, null); + domain.getCommandStack().execute(emfCommand); + + // Get the entry after the modification and try to apply listener if possible + this.entry = LabelInternationalizationUtils.getInternationalizationEntry(namedElement, namedElement); + firstListenerAdded(); + } catch (Exception ex) { + Activator.log.error(ex); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + */ + public Object getValueType() { + return UMLPackage.eINSTANCE.getNamedElement__GetLabel(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#retain() + */ + public void retain() { + refCount.retain(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#release() + */ + public void release() { + refCount.release(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#autorelease() + */ + public void autorelease() { + refCount.autorelease(); + } + +}
\ No newline at end of file diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java index 11105c39e4a..d5dca8fa07a 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java @@ -11,6 +11,7 @@ * Christian W. Damus (CEA) - bug 323802 * Christian W. Damus (CEA) - bug 440108 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.properties.modelelement; @@ -25,7 +26,6 @@ import java.util.Set; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.emf.databinding.EMFProperties; import org.eclipse.emf.databinding.FeaturePath; @@ -38,6 +38,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.papyrus.infra.emf.utils.HistoryUtil; +import org.eclipse.papyrus.infra.internationalization.utils.utils.InternationalizationConstants; import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement; import org.eclipse.papyrus.infra.properties.ui.providers.FeatureContentProvider; import org.eclipse.papyrus.infra.ui.emf.providers.EMFGraphicalContentProvider; @@ -52,6 +53,8 @@ import org.eclipse.papyrus.uml.properties.creation.ConnectorTypeEditorFactory; import org.eclipse.papyrus.uml.properties.creation.MessageValueSpecificationFactory; import org.eclipse.papyrus.uml.properties.creation.OwnedRuleCreationFactory; import org.eclipse.papyrus.uml.properties.creation.UMLPropertyEditorFactory; +import org.eclipse.papyrus.uml.properties.databinding.KeywordObservableValue; +import org.eclipse.papyrus.uml.properties.databinding.UMLLabelObservableValue; import org.eclipse.papyrus.uml.tools.databinding.ExtensionRequiredObservableValue; import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableList; import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue; @@ -68,8 +71,11 @@ import org.eclipse.uml2.uml.Connector; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Extension; import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Namespace; import org.eclipse.uml2.uml.ParameterDirectionKind; import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Stereotype; import org.eclipse.uml2.uml.UMLPackage; /** @@ -87,7 +93,7 @@ public class UMLModelElement extends EMFModelElement { * @param source * The EObject represented by this ModelElement */ - public UMLModelElement(EObject source) { + public UMLModelElement(final EObject source) { super(source); } @@ -100,65 +106,65 @@ public class UMLModelElement extends EMFModelElement { * @param domain * The EditingDomain on which the commands will be executed */ - public UMLModelElement(EObject source, EditingDomain domain) { + public UMLModelElement(final EObject source, final EditingDomain domain) { super(source, domain); } @Override - public IObservable doGetObservable(String propertyPath) { - FeaturePath featurePath = getFeaturePath(propertyPath); - EStructuralFeature feature = getFeature(propertyPath); - - if (feature == UMLPackage.eINSTANCE.getExtension_IsRequired()) { - return new ExtensionRequiredObservableValue((Extension) source, domain); - } - - if (feature == UMLPackage.eINSTANCE.getPort_Provided()) { - return new ProvidedInterfaceObservableList((Port) source, domain); - } - - if (feature == UMLPackage.eINSTANCE.getPort_Required()) { - return new RequiredInterfaceObservableList((Port) source, domain); - } - - if (feature == null) { - return null; - } - - if (feature.getUpperBound() != 1) { - IObservableList list = domain == null ? EMFProperties.list(featurePath).observe(source) : new PapyrusObservableList(EMFProperties.list(featurePath).observe(source), domain, getSource(featurePath), feature); - return list; - } - - if ((feature == UMLPackage.Literals.NAMED_ELEMENT__NAME) && (domain != null)) { - // Empty string as a name is not useful, so we unset instead - return new UnsettableStringValue(getSource(featurePath), feature, domain); + public IObservable doGetObservable(final String propertyPath) { + IObservable value = null; + if (InternationalizationConstants.LABEL_PROPERTY_PATH.equals(propertyPath)) { + value = new UMLLabelObservableValue((NamedElement) source, domain); + } else if (InternationalizationConstants.KEYWORD_PROPERTY_PATH.equals(propertyPath)) { + value = new KeywordObservableValue((Stereotype) source, domain); + } else { + FeaturePath featurePath = getFeaturePath(propertyPath); + EStructuralFeature feature = getFeature(propertyPath); + + if (feature == UMLPackage.eINSTANCE.getExtension_IsRequired()) { + value = new ExtensionRequiredObservableValue((Extension) source, domain); + } else if (feature == UMLPackage.eINSTANCE.getPort_Provided()) { + value = new ProvidedInterfaceObservableList((Port) source, domain); + } else if (feature == UMLPackage.eINSTANCE.getPort_Required()) { + value = new RequiredInterfaceObservableList((Port) source, domain); + } else if (feature == null) { + value = null; + } else if (feature.getUpperBound() != 1) { + IObservableList list = domain == null ? EMFProperties.list(featurePath).observe(source) : new PapyrusObservableList(EMFProperties.list(featurePath).observe(source), domain, getSource(featurePath), feature); + value = list; + } else if ((feature == UMLPackage.Literals.NAMED_ELEMENT__NAME) && (domain != null)) { + // Empty string as a name is not useful, so we unset instead + value = new UnsettableStringValue(getSource(featurePath), feature, domain); + } else { + value = domain == null ? EMFProperties.value(featurePath).observe(source) : new PapyrusObservableValue(getSource(featurePath), feature, domain); + } } - - IObservableValue value = domain == null ? EMFProperties.value(featurePath).observe(source) : new PapyrusObservableValue(getSource(featurePath), feature, domain); return value; } @Override - protected boolean isFeatureEditable(String propertyPath) { - EStructuralFeature feature = getFeature(propertyPath); - if (feature == UMLPackage.eINSTANCE.getMessage_Signature()) { - return true; - } - if (feature == UMLPackage.eINSTANCE.getExtension_IsRequired()) { - return true; - } - if (feature == UMLPackage.eINSTANCE.getPort_Provided() || feature == UMLPackage.eINSTANCE.getPort_Required()) { - if (source instanceof Port) { - return ((Port) source).getType() != null; + protected boolean isFeatureEditable(final String propertyPath) { + boolean result = false; + if (InternationalizationConstants.LABEL_PROPERTY_PATH.equals(propertyPath) || InternationalizationConstants.KEYWORD_PROPERTY_PATH.equals(propertyPath)) { + result = true; + } else { + EStructuralFeature feature = getFeature(propertyPath); + if (feature == UMLPackage.eINSTANCE.getMessage_Signature()) { + result = true; + } else if (feature == UMLPackage.eINSTANCE.getExtension_IsRequired()) { + result = true; + } else if (feature == UMLPackage.eINSTANCE.getPort_Provided() || feature == UMLPackage.eINSTANCE.getPort_Required() && + source instanceof Port) { + result = ((Port) source).getType() != null; + } else { + result = super.isFeatureEditable(propertyPath); } } - - return super.isFeatureEditable(propertyPath); + return result; } @Override - public IStaticContentProvider getContentProvider(String propertyPath) { + public IStaticContentProvider getContentProvider(final String propertyPath) { EStructuralFeature feature = getFeature(propertyPath); if (feature == null) { @@ -176,7 +182,7 @@ public class UMLModelElement extends EMFModelElement { } @Override - public boolean isOrdered(String propertyPath) { + public boolean isOrdered(final String propertyPath) { EStructuralFeature feature = getFeature(propertyPath); if (feature == UMLPackage.eINSTANCE.getStereotype_Icon()) { return true; @@ -185,7 +191,7 @@ public class UMLModelElement extends EMFModelElement { } @Override - public ReferenceValueFactory getValueFactory(String propertyPath) { + public ReferenceValueFactory getValueFactory(final String propertyPath) { EStructuralFeature feature = getFeature(propertyPath); if (!(feature instanceof EReference)) { return null; diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java index 98310b631c3..f0dc34faaeb 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java @@ -11,6 +11,7 @@ * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification * Ansgar Radermacher (CEA LIST) Ansgar.Radermacher@cea.fr - modification, clean-up + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel; @@ -22,6 +23,7 @@ import org.eclipse.emf.ecore.EModelElement; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.Message; import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider; import org.eclipse.papyrus.uml.profile.tree.ProfileElementLabelProvider; @@ -201,7 +203,7 @@ public class PropertyComposite extends DecoratedTreeComposite { if (property.isMultivalued() || (currentPropertyValues.size() < upper)) { ValueTreeObject.createInstance(pTO, null).editMe(); } else { - Message.warning("Upper multiplicity of " + property.getName() + " is " + property.getUpper()); + Message.warning("Upper multiplicity of " + UMLLabelInternationalization.getInstance().getLabel(property) + " is " + property.getUpper()); } // Update value tree objects pTO.reInitChilds(); diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/ChooseSetStereotypeDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/ChooseSetStereotypeDialog.java index 4ee6c8f7381..7477ce1a4ca 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/ChooseSetStereotypeDialog.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/ChooseSetStereotypeDialog.java @@ -1,229 +1,231 @@ -/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.profile.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.papyrus.uml.profile.ui.dialogs.AlphabeticalViewerSorter;
-import org.eclipse.papyrus.uml.profile.ui.dialogs.ChooseSetAssistedDialog;
-import org.eclipse.papyrus.uml.profile.ui.dialogs.IChooseDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.uml2.uml.Stereotype;
-
-
-
-/**
- * Dialog that allows user to add/remove stereotypes to an element.
- *
- * @author Patrick Tessier, Remi Schnekenburger
- */
-public class ChooseSetStereotypeDialog extends ChooseSetAssistedDialog implements IChooseDialog {
-
- /**
- * LabelProvider for stereotype completion proposal provider with qualified names.
- */
- final private StereotypeQualifiedLabelProvider qualifiedLabelProvider = new StereotypeQualifiedLabelProvider();
-
- /**
- * Default Constructor.
- *
- * @param parentShell
- * the parent shell
- * @param theElement
- * the UML element to be modified
- */
- public ChooseSetStereotypeDialog(Shell parentShell, org.eclipse.uml2.uml.Element theElement) {
- super(parentShell,
- "Applicable Stereotypes: ",
- "Applied Stereotypes: ");
- labelProvider = new StereotypeLabelProvider();
- decoratedContentProposalProvider = new StereotypeContentProposalProvider();
-
- Iterator<Stereotype> stereotypes = theElement.getAppliedStereotypes().iterator();
- while (stereotypes.hasNext()) {
- selectedElementList.addElement(stereotypes.next());
- }
-
- stereotypes = theElement.getApplicableStereotypes().iterator();
- while (stereotypes.hasNext()) {
- Stereotype current = stereotypes.next();
- if (!selectedElementList.contains(current)) {
- possibleElementList.addElement(current);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- /**
- * Creates the dialog area.
- *
- * @param parent
- * the parent
- *
- * @return the control
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Control composite = super.createDialogArea(parent);
-
- // Add 2 columns to the table area
- // possibleElementsTable.setLinesVisible(true);
- possibleElementsTable.setHeaderVisible(true);
-
- // 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!!
- TableColumn column = new TableColumn(possibleElementsTable, SWT.CENTER, 0);
- column.setText("Stereotype");
- column.setWidth(150);
- column.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0));
- }
- });
-
- // 2nd column with task Description
- column = new TableColumn(possibleElementsTable, SWT.LEFT, 1);
- column.setText("Information");
- column.setWidth(165);
- // Add listener to column so tasks are sorted by description when clicked
- column.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(1));
- }
- });
-
- // set sorter to the possible element table viewer
- possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0));
-
- return composite;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#runAddElement(java.lang.String)
- */
- /**
- * Run add element.
- *
- * @param name
- * the name
- */
- @Override
- protected void runAddElement(String name) {
- // find the stereotype in the list
- Stereotype stereotype = null;
- Iterator<Stereotype> it = possibleElementList.getElements().iterator();
- while (it.hasNext()) {
- Stereotype element = it.next();
- if (name.equalsIgnoreCase(element.getName()) || name.equalsIgnoreCase(element.getQualifiedName())) {
- stereotype = element;
- }
- }
- if (stereotype != null) {
- runActionAdd(stereotype);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#isSelectableElement(java.lang.String)
- */
- /**
- * Checks if is selectable element.
- *
- * @param text
- * the text
- *
- * @return true, if is selectable element
- */
- @Override
- protected boolean isSelectableElement(String text) {
- // iterate through all possibilities and return true if text corresponds
- Iterator<Stereotype> it = possibleElementList.getElements().iterator();
- while (it.hasNext()) {
- Stereotype element = it.next();
- if (text.equalsIgnoreCase(element.getName()) || text.equalsIgnoreCase(element.getQualifiedName())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Content Proposal provider for stereotypes dialog. Propose the simple
- * name of the stereotype and its qualified name.
- *
- * @author Remi Schnekenburger
- */
- public class StereotypeContentProposalProvider extends DecoratedContentProposalProvider {
-
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog.DecoratedContentProposalProvider#getProposals(java.lang.String, int)
- */
- /**
- * Gets the proposals.
- *
- * @param contents
- * the contents
- * @param position
- * the position
- *
- * @return the proposals
- */
- @Override
- public DecoratedContentProposal[] getProposals(String contents, int position) {
- ArrayList<DecoratedContentProposal> proposals = new ArrayList<DecoratedContentProposal>();
-
- if (possibleElementList != null) {
- Iterator it = possibleElementList.getElements().iterator();
- while (it.hasNext()) {
- final Stereotype stereotype = (Stereotype) it.next();
- final String simpleName = stereotype.getName();
- final String qualifiedName = stereotype.getQualifiedName();
-
- if (position < simpleName.length() && contents.substring(0, position).equalsIgnoreCase(simpleName.substring(0, position))) {
- proposals.add(new DecoratedContentProposal(stereotype, labelProvider));
- }
-
- if (position < qualifiedName.length() && contents.substring(0, position).equalsIgnoreCase(qualifiedName.substring(0, position))) {
- proposals.add(new DecoratedContentProposal(stereotype, qualifiedLabelProvider));
- }
- }
- }
-
- Collections.sort(proposals);
- return proposals.toArray(new DecoratedContentProposal[proposals.size()]);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2008 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.properties.profile.ui.dialogs; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.profile.ui.dialogs.AlphabeticalViewerSorter; +import org.eclipse.papyrus.uml.profile.ui.dialogs.ChooseSetAssistedDialog; +import org.eclipse.papyrus.uml.profile.ui.dialogs.IChooseDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.uml2.uml.Stereotype; + + + +/** + * Dialog that allows user to add/remove stereotypes to an element. + * + * @author Patrick Tessier, Remi Schnekenburger + */ +public class ChooseSetStereotypeDialog extends ChooseSetAssistedDialog implements IChooseDialog { + + /** + * LabelProvider for stereotype completion proposal provider with qualified names. + */ + final private StereotypeQualifiedLabelProvider qualifiedLabelProvider = new StereotypeQualifiedLabelProvider(); + + /** + * Default Constructor. + * + * @param parentShell + * the parent shell + * @param theElement + * the UML element to be modified + */ + public ChooseSetStereotypeDialog(Shell parentShell, org.eclipse.uml2.uml.Element theElement) { + super(parentShell, + "Applicable Stereotypes: ", + "Applied Stereotypes: "); + labelProvider = new StereotypeLabelProvider(); + decoratedContentProposalProvider = new StereotypeContentProposalProvider(); + + Iterator<Stereotype> stereotypes = theElement.getAppliedStereotypes().iterator(); + while (stereotypes.hasNext()) { + selectedElementList.addElement(stereotypes.next()); + } + + stereotypes = theElement.getApplicableStereotypes().iterator(); + while (stereotypes.hasNext()) { + Stereotype current = stereotypes.next(); + if (!selectedElementList.contains(current)) { + possibleElementList.addElement(current); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + /** + * Creates the dialog area. + * + * @param parent + * the parent + * + * @return the control + */ + @Override + protected Control createDialogArea(Composite parent) { + Control composite = super.createDialogArea(parent); + + // Add 2 columns to the table area + // possibleElementsTable.setLinesVisible(true); + possibleElementsTable.setHeaderVisible(true); + + // 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!! + TableColumn column = new TableColumn(possibleElementsTable, SWT.CENTER, 0); + column.setText("Stereotype"); + column.setWidth(150); + column.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); + } + }); + + // 2nd column with task Description + column = new TableColumn(possibleElementsTable, SWT.LEFT, 1); + column.setText("Information"); + column.setWidth(165); + // Add listener to column so tasks are sorted by description when clicked + column.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(1)); + } + }); + + // set sorter to the possible element table viewer + possibleElementsTableViewer.setSorter(new AlphabeticalViewerSorter(0)); + + return composite; + } + + /* + * (non-Javadoc) + * + * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#runAddElement(java.lang.String) + */ + /** + * Run add element. + * + * @param name + * the name + */ + @Override + protected void runAddElement(String name) { + // find the stereotype in the list + Stereotype stereotype = null; + Iterator<Stereotype> it = possibleElementList.getElements().iterator(); + while (it.hasNext()) { + Stereotype element = it.next(); + if (name.equalsIgnoreCase(UMLLabelInternationalization.getInstance().getKeyword(element)) || name.equalsIgnoreCase(element.getQualifiedName())) { + stereotype = element; + } + } + if (stereotype != null) { + runActionAdd(stereotype); + } + } + + /* + * (non-Javadoc) + * + * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog#isSelectableElement(java.lang.String) + */ + /** + * Checks if is selectable element. + * + * @param text + * the text + * + * @return true, if is selectable element + */ + @Override + protected boolean isSelectableElement(String text) { + // iterate through all possibilities and return true if text corresponds + Iterator<Stereotype> it = possibleElementList.getElements().iterator(); + while (it.hasNext()) { + Stereotype element = it.next(); + if (text.equalsIgnoreCase(UMLLabelInternationalization.getInstance().getKeyword(element)) || text.equalsIgnoreCase(element.getQualifiedName())) { + return true; + } + } + return false; + } + + /** + * Content Proposal provider for stereotypes dialog. Propose the simple + * name of the stereotype and its qualified name. + * + * @author Remi Schnekenburger + */ + public class StereotypeContentProposalProvider extends DecoratedContentProposalProvider { + + /* + * (non-Javadoc) + * + * @see com.cea.papyrus.ui.dialogs.ChooseSetAssistedDialog.DecoratedContentProposalProvider#getProposals(java.lang.String, int) + */ + /** + * Gets the proposals. + * + * @param contents + * the contents + * @param position + * the position + * + * @return the proposals + */ + @Override + public DecoratedContentProposal[] getProposals(String contents, int position) { + ArrayList<DecoratedContentProposal> proposals = new ArrayList<DecoratedContentProposal>(); + + if (possibleElementList != null) { + Iterator it = possibleElementList.getElements().iterator(); + while (it.hasNext()) { + final Stereotype stereotype = (Stereotype) it.next(); + final String simpleName = UMLLabelInternationalization.getInstance().getKeyword(stereotype); + final String qualifiedName = stereotype.getQualifiedName(); + + if (position < simpleName.length() && contents.substring(0, position).equalsIgnoreCase(simpleName.substring(0, position))) { + proposals.add(new DecoratedContentProposal(stereotype, labelProvider)); + } + + if (position < qualifiedName.length() && contents.substring(0, position).equalsIgnoreCase(qualifiedName.substring(0, position))) { + proposals.add(new DecoratedContentProposal(stereotype, qualifiedLabelProvider)); + } + } + } + + Collections.sort(proposals); + return proposals.toArray(new DecoratedContentProposal[proposals.size()]); + } + } +} diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/StereotypeLabelProvider.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/StereotypeLabelProvider.java index a3c9d30c9b6..4cb88c49192 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/StereotypeLabelProvider.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/StereotypeLabelProvider.java @@ -1,78 +1,80 @@ -/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.profile.ui.dialogs;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.uml.profile.ImageManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Stereotype;
-
-
-/**
- * Label provider for stereotypes.
- */
-public class StereotypeLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(Object element) {
- return ImageManager.IMG_STEREOTYPE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object stereotype) {
- if (!(stereotype instanceof Stereotype)) {
- return "not a stereotype";
- } else {
- return ((Stereotype) stereotype).getName();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return getImage(element);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return getText(element);
- } else if (columnIndex == 1) {
- return ((Stereotype) element).getQualifiedName();
- }
- return "not the right column index";
- }
-}
+/***************************************************************************** + * Copyright (c) 2008 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.properties.profile.ui.dialogs; + +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.profile.ImageManager; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.Stereotype; + + +/** + * Label provider for stereotypes. + */ +public class StereotypeLabelProvider extends LabelProvider implements ITableLabelProvider { + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) + */ + @Override + public Image getImage(Object element) { + return ImageManager.IMG_STEREOTYPE; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) + */ + @Override + public String getText(Object stereotype) { + if (!(stereotype instanceof Stereotype)) { + return "not a stereotype"; + } else { + return UMLLabelInternationalization.getInstance().getKeyword((Stereotype) stereotype); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) + */ + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 0) { + return getImage(element); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) + */ + public String getColumnText(Object element, int columnIndex) { + if (columnIndex == 0) { + return getText(element); + } else if (columnIndex == 1) { + return ((Stereotype) element).getQualifiedName(); + } + return "not the right column index"; + } +}
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF index b0f883f1e61..b8185543787 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.collaborationuse.xtext;bundle-v org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.textedit.common.xtext.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.apache.log4j;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java index 52ae708f557..93a3f93991d 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java @@ -1,212 +1,227 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.internal.UmlCollaborationUseActivator;
-import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
-import org.eclipse.uml2.uml.Collaboration;
-import org.eclipse.uml2.uml.CollaborationUse;
-import org.eclipse.uml2.uml.UMLPackage;
-
-import com.google.inject.Injector;
-
-/**
- *
- * Editor for the {@link CollaborationUse}
- *
- */
-public class CollaborationUseEditor extends DefaultXtextDirectEditorConfiguration {
-
- /** the new name for the {@link CollaborationUse} */
- private String newName;
-
- /** the new type for the {@link CollaborationUse} */
- private Collaboration newType;
-
- /** the new visibility for the {@link CollaborationUse} */
- private org.eclipse.uml2.uml.VisibilityKind newVisibility;
-
- /** the managed {@link CollaborationUse} */
- private CollaborationUse collaborationUse;
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#createPopupEditorHelper(java.lang.Object)
- *
- * @param editPart
- * @return
- */
- /*
- * public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
- *
- * // resolves the edit part, and the associated semantic element
- * IGraphicalEditPart graphicalEditPart = null;
- * if(!(editPart instanceof IGraphicalEditPart)) {
- * return null;
- * }
- * graphicalEditPart = (IGraphicalEditPart)editPart;
- *
- * if(!(graphicalEditPart.resolveSemanticElement() instanceof CollaborationUse)) {
- * return null;
- * }
- * collaborationUse = (CollaborationUse)graphicalEditPart.resolveSemanticElement();
- *
- * // retrieves the XText injector
- * Injector injector = UmlCollaborationUseActivator.getInstance().getInjector("org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.UmlCollaborationUse"); //$NON-NLS-1$
- *
- * // builds the text content and extension for a temporary file, to be edited by the xtext editor
- * String textToEdit = "" + this.getTextToEdit(graphicalEditPart.resolveSemanticElement()); //$NON-NLS-1$
- * String fileExtension = "" + ".umlcollaborationuse"; //$NON-NLS-1$ //$NON-NLS-2$
- *
- * // builds a new IXtextEMFReconciler.
- * // Its purpose is to extract any relevant information from the textual specification,
- * // and then merge it in the context UML model if necessary
- * IXtextEMFReconciler reconciler = new IXtextEMFReconciler() {
- *
- * public void reconcile(EObject modelObject, EObject xtextObject) {
- * // first: retrieves / determines if the xtextObject is a CollaborationUseRule object
- * EObject modifiedObject = xtextObject;
- * if(!(modelObject instanceof CollaborationUse)) {
- * return;
- * }
- * while(xtextObject != null && !(xtextObject instanceof CollaborationUseRule)) {
- * modifiedObject = modifiedObject.eContainer();
- * }
- * if(modifiedObject == null) {
- * return;
- * }
- * CollaborationUseRule propertyRuleObject = (CollaborationUseRule)xtextObject;
- *
- * // Retrieves the information to be populated in modelObject
- *
- *
- * newName = "" + propertyRuleObject.getName(); //$NON-NLS-1$
- *
- * TypeRule typeRule = propertyRuleObject.getType();
- * if(typeRule == null) {
- * newType = null;
- * } else {
- * newType = (Collaboration)typeRule.getType();
- * }
- *
- * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
- *
- * switch(propertyRuleObject.getVisibility()) {
- * case PUBLIC:
- * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
- * break;
- * case PACKAGE:
- * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PACKAGE_LITERAL;
- * break;
- * case PRIVATE:
- * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PRIVATE_LITERAL;
- * break;
- * case PROTECTED:
- * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PROTECTED_LITERAL;
- * break;
- * default:
- * break;
- * }
- *
- * IUndoableOperation updateCommand = getUpdateCommand();
- *
- * try {
- * CheckedOperationHistory.getInstance().execute(updateCommand, new NullProgressMonitor(), null);
- * } catch (ExecutionException e) {
- * System.err.println(e);
- * }
- * }
- * };
- * return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new SemanticValidator());
- * }
- */
-
- /**
- * Returns the list of requests to update the {@link #collaborationUse}
- *
- * @return
- * the list of requests to update the {@link #collaborationUse}
- */
- protected List<SetRequest> getRequests() {
- List<SetRequest> requests = new ArrayList<SetRequest>();
- requests.add(new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getNamedElement_Name(), newName));
- requests.add(new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility));
- requests.add(new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getCollaborationUse_Type(), newType));
- return requests;
- }
-
- /**
- * Returns the update command
- *
- * @return
- * the update command
- */
- protected IUndoableOperation getUpdateCommand() {
- CompositeCommand cc = new CompositeCommand("Set values for CollaborationUse"); //$NON-NLS-1$
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(collaborationUse);
- if (provider != null) {
-
- ICommand editCommand = null;
- for (SetRequest current : getRequests()) {
- editCommand = provider.getEditCommand(current);
-
- if (editCommand != null && editCommand.canExecute()) {
- cc.add(editCommand);
- }
- }
- }
- return cc;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object)
- *
- * @param editedObject
- * @return
- */
- @Override
- public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof CollaborationUse) {
- return UMLCollaborationUseEditorUtil.getLabel((CollaborationUse) editedObject).trim();
- // TODO: default values not supported by the grammar
- // TODO: either complete the grammar, or use another label provider
- }
- return "not a CollaborationUse"; //$NON-NLS-1$
- }
-
- @Override
- public Injector getInjector() {
- return UmlCollaborationUseActivator.getInstance().getInjector(UmlCollaborationUseActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_COLLABORATIONUSE_XTEXT_UMLCOLLABORATIONUSE);
- }
-
- @Override
- protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
- if (!(umlObject instanceof CollaborationUse)) {
- return null;
- }
-
- // Creates and executes the update command
- IUndoableOperation updateCommand = getUpdateCommand();
- return (ICommand) updateCommand;
- }
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.operations.IUndoableOperation; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.internal.UmlCollaborationUseActivator; +import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.CollaborationUse; +import org.eclipse.uml2.uml.UMLPackage; + +import com.google.inject.Injector; + +/** + * + * Editor for the {@link CollaborationUse} + * + */ +public class CollaborationUseEditor extends DefaultXtextDirectEditorConfiguration { + + /** the new name for the {@link CollaborationUse} */ + private String newName; + + /** the new type for the {@link CollaborationUse} */ + private Collaboration newType; + + /** the new visibility for the {@link CollaborationUse} */ + private org.eclipse.uml2.uml.VisibilityKind newVisibility; + + /** the managed {@link CollaborationUse} */ + private CollaborationUse collaborationUse; + + /** + * + * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#createPopupEditorHelper(java.lang.Object) + * + * @param editPart + * @return + */ + /* + * public IPopupEditorHelper createPopupEditorHelper(Object editPart) { + * + * // resolves the edit part, and the associated semantic element + * IGraphicalEditPart graphicalEditPart = null; + * if(!(editPart instanceof IGraphicalEditPart)) { + * return null; + * } + * graphicalEditPart = (IGraphicalEditPart)editPart; + * + * if(!(graphicalEditPart.resolveSemanticElement() instanceof CollaborationUse)) { + * return null; + * } + * collaborationUse = (CollaborationUse)graphicalEditPart.resolveSemanticElement(); + * + * // retrieves the XText injector + * Injector injector = UmlCollaborationUseActivator.getInstance().getInjector("org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.UmlCollaborationUse"); //$NON-NLS-1$ + * + * // builds the text content and extension for a temporary file, to be edited by the xtext editor + * String textToEdit = "" + this.getTextToEdit(graphicalEditPart.resolveSemanticElement()); //$NON-NLS-1$ + * String fileExtension = "" + ".umlcollaborationuse"; //$NON-NLS-1$ //$NON-NLS-2$ + * + * // builds a new IXtextEMFReconciler. + * // Its purpose is to extract any relevant information from the textual specification, + * // and then merge it in the context UML model if necessary + * IXtextEMFReconciler reconciler = new IXtextEMFReconciler() { + * + * public void reconcile(EObject modelObject, EObject xtextObject) { + * // first: retrieves / determines if the xtextObject is a CollaborationUseRule object + * EObject modifiedObject = xtextObject; + * if(!(modelObject instanceof CollaborationUse)) { + * return; + * } + * while(xtextObject != null && !(xtextObject instanceof CollaborationUseRule)) { + * modifiedObject = modifiedObject.eContainer(); + * } + * if(modifiedObject == null) { + * return; + * } + * CollaborationUseRule propertyRuleObject = (CollaborationUseRule)xtextObject; + * + * // Retrieves the information to be populated in modelObject + * + * + * newName = "" + propertyRuleObject.getName(); //$NON-NLS-1$ + * + * TypeRule typeRule = propertyRuleObject.getType(); + * if(typeRule == null) { + * newType = null; + * } else { + * newType = (Collaboration)typeRule.getType(); + * } + * + * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL; + * + * switch(propertyRuleObject.getVisibility()) { + * case PUBLIC: + * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL; + * break; + * case PACKAGE: + * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PACKAGE_LITERAL; + * break; + * case PRIVATE: + * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PRIVATE_LITERAL; + * break; + * case PROTECTED: + * newVisibility = org.eclipse.uml2.uml.VisibilityKind.PROTECTED_LITERAL; + * break; + * default: + * break; + * } + * + * IUndoableOperation updateCommand = getUpdateCommand(); + * + * try { + * CheckedOperationHistory.getInstance().execute(updateCommand, new NullProgressMonitor(), null); + * } catch (ExecutionException e) { + * System.err.println(e); + * } + * } + * }; + * return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new SemanticValidator()); + * } + */ + + /** + * Returns the list of requests to update the {@link #collaborationUse} + * + * @return + * the list of requests to update the {@link #collaborationUse} + */ + protected List<SetRequest> getRequests() { + List<SetRequest> requests = new ArrayList<SetRequest>(); + requests.add(new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility)); + requests.add(new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getCollaborationUse_Type(), newType)); + return requests; + } + + /** + * Returns the update command + * + * @return + * the update command + */ + protected IUndoableOperation getUpdateCommand() { + CompositeCommand cc = new CompositeCommand("Set values for CollaborationUse"); //$NON-NLS-1$ + org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(collaborationUse); + if (provider != null) { + + // Manage the name or the label set + ICommand setNameCommand = null; + if(InternationalizationPreferencesUtils.getInternationalizationPreference(collaborationUse) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(collaborationUse)){ + final ModelSet modelSet = (ModelSet)collaborationUse.eResource().getResourceSet(); + setNameCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), collaborationUse, newName, null)); + }else{ + final SetRequest setNameRequest = new SetRequest(collaborationUse, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); + setNameCommand = provider.getEditCommand(setNameRequest); + } + cc.add(setNameCommand); + + ICommand editCommand = null; + for (SetRequest current : getRequests()) { + editCommand = provider.getEditCommand(current); + + if (editCommand != null && editCommand.canExecute()) { + cc.add(editCommand); + } + } + } + return cc; + } + + /** + * + * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object) + * + * @param editedObject + * @return + */ + @Override + public String getTextToEdit(Object editedObject) { + if (editedObject instanceof CollaborationUse) { + return UMLCollaborationUseEditorUtil.getLabel((CollaborationUse) editedObject).trim(); + // TODO: default values not supported by the grammar + // TODO: either complete the grammar, or use another label provider + } + return "not a CollaborationUse"; //$NON-NLS-1$ + } + + @Override + public Injector getInjector() { + return UmlCollaborationUseActivator.getInstance().getInjector(UmlCollaborationUseActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_COLLABORATIONUSE_XTEXT_UMLCOLLABORATIONUSE); + } + + @Override + protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) { + if (!(umlObject instanceof CollaborationUse)) { + return null; + } + + // Creates and executes the update command + IUndoableOperation updateCommand = getUpdateCommand(); + return (ICommand) updateCommand; + } }
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/UMLCollaborationUseEditorUtil.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/UMLCollaborationUseEditorUtil.java index a4f74923321..f15be258a73 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/UMLCollaborationUseEditorUtil.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/UMLCollaborationUseEditorUtil.java @@ -1,116 +1,118 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
-import org.eclipse.uml2.uml.CollaborationUse;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Type;
-
-/**
- *
- * This class provides method to manipulate {@link CollaborationUse}
- *
- */
-public class UMLCollaborationUseEditorUtil {
-
- /**
- * Returns a String representing the {@link CollaborationUse}
- *
- * @param collaborationUse
- * the {@link CollaborationUse}
- * @return
- * A String representing the {@link CollaborationUse}
- */
- public static String getLabel(CollaborationUse collaborationUse) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" "); //$NON-NLS-1$
- buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse));
-
- // name
- buffer.append(" "); //$NON-NLS-1$
- buffer.append(getName(collaborationUse));
-
- // type
- if (collaborationUse.getType() != null) {
- EList<Namespace> namespaces = collaborationUse.allNamespaces();
- buffer.append(" : " + getTypeLabel(collaborationUse.getType(), namespaces.get(namespaces.size() - 1))); //$NON-NLS-1$
- } else {
- buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- /**
- * Returns the name of the {@link CollaborationUse}
- *
- * @param collaborationUse
- * the {@link CollaborationUse}
- * @return
- * The name of the {@link CollaborationUse}
- */
- public static String getName(CollaborationUse collaborationUse) {
- if (collaborationUse.getName() != null) {
- return collaborationUse.getName();
- } else {
- return (NamedElementUtil.getDefaultNameWithIncrement(collaborationUse));
- }
- }
-
- /**
- * Returns a string representing the Type of the {@link CollaborationUse}
- *
- * @param type
- * the type of the CollaborationUse
- * @return
- * A string representing the Type of the {@link CollaborationUse}
- */
- public static String getTypeLabel(Type type, Namespace model) {
- String label = ""; //$NON-NLS-1$
-
- List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages());
-
- List<Package> visitedPackages = new ArrayList<Package>();
- Package currentPackage = type.getNearestPackage();
-
- boolean rootFound = false;
-
- while (currentPackage != null && !rootFound) {
- visitedPackages.add(currentPackage);
- if (importedPackages.contains(currentPackage) || currentPackage == model) {
- rootFound = true;
- }
- Element owner = currentPackage.getOwner();
- while (owner != null && !(owner instanceof Package)) {
- owner = owner.getOwner();
- }
-
- currentPackage = owner != null ? (Package) owner : null;
- }
-
- for (int i = visitedPackages.size() - 1; i >= 0; i--) {
- label += visitedPackages.get(i).getName() + "::"; //$NON-NLS-1$
- }
-
- return label + type.getName();
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.TypeUtil; +import org.eclipse.uml2.uml.CollaborationUse; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Type; + +/** + * + * This class provides method to manipulate {@link CollaborationUse} + * + */ +public class UMLCollaborationUseEditorUtil { + + /** + * Returns a String representing the {@link CollaborationUse} + * + * @param collaborationUse + * the {@link CollaborationUse} + * @return + * A String representing the {@link CollaborationUse} + */ + public static String getLabel(CollaborationUse collaborationUse) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); //$NON-NLS-1$ + buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse)); + + // name + buffer.append(" "); //$NON-NLS-1$ + buffer.append(getName(collaborationUse)); + + // type + if (collaborationUse.getType() != null) { + EList<Namespace> namespaces = collaborationUse.allNamespaces(); + buffer.append(" : " + getTypeLabel(collaborationUse.getType(), namespaces.get(namespaces.size() - 1))); //$NON-NLS-1$ + } else { + buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME); //$NON-NLS-1$ + } + return buffer.toString(); + } + + /** + * Returns the name of the {@link CollaborationUse} + * + * @param collaborationUse + * the {@link CollaborationUse} + * @return + * The name of the {@link CollaborationUse} + */ + public static String getName(CollaborationUse collaborationUse) { + if (collaborationUse.getName() != null) { + return UMLLabelInternationalization.getInstance().getLabel(collaborationUse); + } else { + return (NamedElementUtil.getDefaultNameWithIncrement(collaborationUse)); + } + } + + /** + * Returns a string representing the Type of the {@link CollaborationUse} + * + * @param type + * the type of the CollaborationUse + * @return + * A string representing the Type of the {@link CollaborationUse} + */ + public static String getTypeLabel(Type type, Namespace model) { + String label = ""; //$NON-NLS-1$ + + List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages()); + + List<Package> visitedPackages = new ArrayList<Package>(); + Package currentPackage = type.getNearestPackage(); + + boolean rootFound = false; + + while (currentPackage != null && !rootFound) { + visitedPackages.add(currentPackage); + if (importedPackages.contains(currentPackage) || currentPackage == model) { + rootFound = true; + } + Element owner = currentPackage.getOwner(); + while (owner != null && !(owner instanceof Package)) { + owner = owner.getOwner(); + } + + currentPackage = owner != null ? (Package) owner : null; + } + + for (int i = visitedPackages.size() - 1; i >= 0; i--) { + label += visitedPackages.get(i).getName() + "::"; //$NON-NLS-1$ + } + + return label + type.getName(); + } +} diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF index 740760b4779..7f546d28385 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF @@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.message.xtext;bundle-version="[ org.eclipse.papyrus.uml.alf.common.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.diagram.communication;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java index 46755c82976..024e4a0af43 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java @@ -1,138 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.message.xtext.ui.contributions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.papyrus.uml.textedit.message.xtext.ui.internal.UmlMessageActivator;
-import org.eclipse.papyrus.uml.textedit.message.xtext.umlMessage.MessageRule;
-import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Message;
-
-import com.google.inject.Injector;
-
-public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration {
-
- @Override
- public Injector getInjector() {
- return UmlMessageActivator.getInstance().getInjector(UmlMessageActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_MESSAGE_XTEXT_UMLMESSAGE);
- }
-
- @Override
- protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
- Message message = (Message) umlObject;
- EObject modifiedObject = xtextObject;
- while (modifiedObject != null && !(modifiedObject instanceof MessageRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if (modifiedObject == null) {
- return UnexecutableCommand.INSTANCE;
- }
- MessageRule messageRuleObject = (MessageRule) xtextObject;
-
- // Retrieves the information to be populated in modelObject
- String newName = "" + messageRuleObject.getName();
-
- int ocnumber = messageRuleObject.getSequenceTerm().get(0).getSequencialOrder();
-
- String ocname = "";
-
- String newSequenceTermList = "";
- int i = 0;
- String recurrence;
- for (i = 0; i < messageRuleObject.getSequenceTerm().size(); i++) {
- if (messageRuleObject.getSequenceTerm().get(i).getSequenceName() != null) {
- ocname = messageRuleObject.getSequenceTerm().get(i).getSequenceName().toString();
- }
- ocnumber = messageRuleObject.getSequenceTerm().get(i).getSequencialOrder();
- if (messageRuleObject.getSequenceTerm().get(i).getRecurrence() != null) {
- recurrence = messageRuleObject.getSequenceTerm().get(i).getRecurrence().trim();
- }
- if ((i == 0)) {
- newSequenceTermList = newSequenceTermList + ocnumber + ocname;
- } else {
- newSequenceTermList = newSequenceTermList + '.' + ocnumber + ocname;
- }
- }
-
- return new UpdateUMLMessageCommand(message, newName, newSequenceTermList);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object)
- *
- * @param editedObject
- * @return the text to edit
- */
-
- @SuppressWarnings("rawtypes")
- @Override
- public String getTextToEdit(Object editedObject) {
-
- if (editedObject instanceof Message) {
- String texttoedit = ((Message) editedObject).getName().trim();
-
- Interaction interaction = ((Message) editedObject).getInteraction();
-
- int sequencenumber = 0;
- for (Iterator it = interaction.getMessages().iterator(); it.hasNext();) {
- sequencenumber++;
- Message childElement = (Message) it.next();
- if (childElement.equals(editedObject)) {
- if ((texttoedit.charAt(0) >= 48) && (texttoedit.charAt(0) <= 57)) {
- return texttoedit;
- } else {
- return texttoedit = sequencenumber + ":" + texttoedit;
- }
- }
- }
- }
-
- return "not a Message";
- }
-
- /**
- * The Class UpdateUMLMessageCommand.
- */
- protected static class UpdateUMLMessageCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
-
- private Message message;
-
- private String newName;
-
- private String newSequenceTermList;
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
- this.message.setName(newSequenceTermList + ':' + newName);
- return CommandResult.newOKCommandResult(message);
- }
-
- public UpdateUMLMessageCommand(Message message, String newName, String newSequenceTermList) {
- super(TransactionUtil.getEditingDomain(message), "Message Update", getWorkspaceFiles(message));
- this.message = message;
- this.newName = newName;
- this.newSequenceTermList = newSequenceTermList;
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.message.xtext.ui.contributions; + +import java.util.Iterator; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.textedit.message.xtext.ui.internal.UmlMessageActivator; +import org.eclipse.papyrus.uml.textedit.message.xtext.umlMessage.MessageRule; +import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Message; + +import com.google.inject.Injector; + +public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration { + + @Override + public Injector getInjector() { + return UmlMessageActivator.getInstance().getInjector(UmlMessageActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_MESSAGE_XTEXT_UMLMESSAGE); + } + + @Override + protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) { + Message message = (Message) umlObject; + EObject modifiedObject = xtextObject; + while (modifiedObject != null && !(modifiedObject instanceof MessageRule)) { + modifiedObject = modifiedObject.eContainer(); + } + if (modifiedObject == null) { + return UnexecutableCommand.INSTANCE; + } + MessageRule messageRuleObject = (MessageRule) xtextObject; + + // Retrieves the information to be populated in modelObject + String newName = "" + messageRuleObject.getName(); + + int ocnumber = messageRuleObject.getSequenceTerm().get(0).getSequencialOrder(); + + String ocname = ""; + + String newSequenceTermList = ""; + int i = 0; + String recurrence; + for (i = 0; i < messageRuleObject.getSequenceTerm().size(); i++) { + if (messageRuleObject.getSequenceTerm().get(i).getSequenceName() != null) { + ocname = messageRuleObject.getSequenceTerm().get(i).getSequenceName().toString(); + } + ocnumber = messageRuleObject.getSequenceTerm().get(i).getSequencialOrder(); + if (messageRuleObject.getSequenceTerm().get(i).getRecurrence() != null) { + recurrence = messageRuleObject.getSequenceTerm().get(i).getRecurrence().trim(); + } + if ((i == 0)) { + newSequenceTermList = newSequenceTermList + ocnumber + ocname; + } else { + newSequenceTermList = newSequenceTermList + '.' + ocnumber + ocname; + } + } + + return new UpdateUMLMessageCommand(message, newName, newSequenceTermList); + } + + /** + * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object) + * + * @param editedObject + * @return the text to edit + */ + + @SuppressWarnings("rawtypes") + @Override + public String getTextToEdit(Object editedObject) { + + if (editedObject instanceof Message) { + String texttoedit = UMLLabelInternationalization.getInstance().getLabel(((Message) editedObject)).trim(); + + Interaction interaction = ((Message) editedObject).getInteraction(); + + int sequencenumber = 0; + for (Iterator it = interaction.getMessages().iterator(); it.hasNext();) { + sequencenumber++; + Message childElement = (Message) it.next(); + if (childElement.equals(editedObject)) { + if ((texttoedit.charAt(0) >= 48) && (texttoedit.charAt(0) <= 57)) { + return texttoedit; + } else { + return texttoedit = sequencenumber + ":" + texttoedit; + } + } + } + } + + return "not a Message"; + } + + /** + * The Class UpdateUMLMessageCommand. + */ + protected static class UpdateUMLMessageCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand { + + private Message message; + + private String newName; + + private String newSequenceTermList; + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException { + if(InternationalizationPreferencesUtils.getInternationalizationPreference(message) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(message)){ + UMLLabelInternationalization.getInstance().setLabel(message, newName, null); + }else{ + this.message.setName(newSequenceTermList + ':' + newName); + } + return CommandResult.newOKCommandResult(message); + } + + public UpdateUMLMessageCommand(Message message, String newName, String newSequenceTermList) { + super(TransactionUtil.getEditingDomain(message), "Message Update", getWorkspaceFiles(message)); + this.message = message; + this.newName = newName; + this.newSequenceTermList = newSequenceTermList; + } + } +} diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF index 09329834d33..72ad56338e3 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF @@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.parameter.xtext;bundle-version= org.eclipse.papyrus.uml.textedit.common.xtext.ui;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)", org.apache.log4j;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java index 69121f363dd..60fafb84176 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java @@ -1,358 +1,391 @@ -package org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.internal.UmlParameterActivator;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.BooleanLiterals;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.DirectionRule;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ParameterRule;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.Value;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.VisibilityRule;
-import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.util.UmlParameterSwitch;
-import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
-import org.eclipse.uml2.uml.LiteralBoolean;
-import org.eclipse.uml2.uml.LiteralInteger;
-import org.eclipse.uml2.uml.LiteralNull;
-import org.eclipse.uml2.uml.LiteralReal;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.ParameterEffectKind;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-import com.google.inject.Injector;
-
-
-public class ParameterXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
-
- @Override
- public Injector getInjector() {
- return UmlParameterActivator.getInstance().getInjector(UmlParameterActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PARAMETER_XTEXT_UMLPARAMETER);
- }
-
- @Override
- protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
- CompositeCommand cc = new CompositeCommand("Set values for Parameter"); //$NON-NLS-1$
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(umlObject);
- if (provider != null) {
-
- ICommand editCommand = null;
- for (IEditCommandRequest current : getRequests(umlObject, xtextObject)) {
- editCommand = provider.getEditCommand(current);
-
- if (editCommand != null && editCommand.canExecute()) {
- cc.add(editCommand);
- }
- }
- }
- return cc;
- }
-
- /**
- * Returns the list of requests to update the {@link #parameter}
- *
- * @return
- * the list of requests to update the {@link #parameter}
- */
- protected List<IEditCommandRequest> getRequests(EObject modelObject, EObject xtextObject) {
- List<IEditCommandRequest> requests = new ArrayList<IEditCommandRequest>();
-
-
- // first: retrieves / determines if the xtextObject is a CollaborationUseRule object
- EObject modifiedObject = xtextObject;
- if (!(modelObject instanceof Parameter)) {
- return requests;
- }
- while (xtextObject != null && !(xtextObject instanceof ParameterRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if (modifiedObject == null) {
- return requests;
- }
-
- final ParameterRule parameterRuleObject = (ParameterRule) xtextObject;
-
- final Parameter parameter = (Parameter) modelObject;
-
- // Retrieves the information to be populated in modelObject
- if (parameterRuleObject.getModifiers() != null) {
- /** the new value for isException */
- boolean newIsException = false;
-
- /** the new value for isStream */
- boolean newIsStream = false;
-
- /** the new value for isOrdered */
- boolean newIsOrdered = false;
-
- /** the new value for isUnique */
- boolean newIsUnique = false;
-
- for (org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ModifierSpecification modifier : parameterRuleObject.getModifiers().getValues()) {
- switch (modifier.getValue()) {
- case ORDERED:
- newIsOrdered = true;
- break;
- case UNIQUE:
- newIsUnique = true;
- break;
- case EXCEPTION:
- newIsException = true;
- break;
- case STREAM:
- newIsStream = true;
- break;
- default:
- break;
- }
- }
-
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsException(), newIsException));
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsStream(), newIsStream));
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered(), newIsOrdered));
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), newIsUnique));
- }
-
- if (parameterRuleObject.getMultiplicity() != null) {
- /** the new lowerBound */
- int newLowerBound = 1;
-
- /** the new upperBound */
- int newUpperBound = 1;
-
- if (parameterRuleObject.getMultiplicity().getBounds().size() == 1) {
- String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue();
- if (tempBound.equals("*")) { //$NON-NLS-1$
- newLowerBound = 0;
- newUpperBound = -1;
- } else {
- newLowerBound = new Integer(tempBound).intValue();
- newUpperBound = new Integer(tempBound).intValue();
- }
- } else { // size == 2
- String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue();
- newLowerBound = new Integer(tempBound).intValue();
- tempBound = parameterRuleObject.getMultiplicity().getBounds().get(1).getValue();
- if (tempBound.equals("*")) { //$NON-NLS-1$
- newUpperBound = -1;
- } else {
- newUpperBound = new Integer(tempBound).intValue();
- }
- }
-
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), newLowerBound));
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), newUpperBound));
- }
-
- boolean setType = false;
- TypeRule typeRule = parameterRuleObject.getType();
- Type newType = null;
- if (parameterRuleObject.isTypeUndefined()) {
- setType = true;
- } else if (typeRule != null) {
- newType = typeRule.getType();
- setType = newType != parameter.getType();
- } // Else: no change
-
- if (setType) {
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getTypedElement_Type(), newType));
- }
-
- if (parameterRuleObject.getVisibility() != null) {
- org.eclipse.uml2.uml.VisibilityKind newVisibility;
-
- VisibilityRule visibility = parameterRuleObject.getVisibility();
-
- newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
-
- switch (visibility.getVisibility()) {
- case PUBLIC:
- newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
- break;
- case PACKAGE:
- newVisibility = org.eclipse.uml2.uml.VisibilityKind.PACKAGE_LITERAL;
- break;
- case PRIVATE:
- newVisibility = org.eclipse.uml2.uml.VisibilityKind.PRIVATE_LITERAL;
- break;
- case PROTECTED:
- newVisibility = org.eclipse.uml2.uml.VisibilityKind.PROTECTED_LITERAL;
- break;
- default:
- break;
- }
-
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility));
- }
-
- if (parameterRuleObject.getDirection() != null) {
- DirectionRule direction = parameterRuleObject.getDirection();
-
- ParameterDirectionKind newDirection = ParameterDirectionKind.IN_LITERAL;
-
- switch (direction.getDirection()) {
- case IN:
- newDirection = ParameterDirectionKind.IN_LITERAL;
- break;
- case OUT:
- newDirection = ParameterDirectionKind.OUT_LITERAL;
- break;
- case INOUT:
- newDirection = ParameterDirectionKind.INOUT_LITERAL;
- break;
- case RETURN:
- newDirection = ParameterDirectionKind.RETURN_LITERAL;
- break;
- }
-
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Direction(), newDirection));
- }
-
- if (parameterRuleObject.getEffect() != null) {
- /** the new effect for the parameter */
- ParameterEffectKind newEffect = ParameterEffectKind.CREATE_LITERAL;
-
- switch (parameterRuleObject.getEffect().getEffectKind()) {
- case CREATE:
- newEffect = ParameterEffectKind.CREATE_LITERAL;
- break;
- case DELETE:
- newEffect = ParameterEffectKind.DELETE_LITERAL;
- break;
- case READ:
- newEffect = ParameterEffectKind.READ_LITERAL;
- break;
- case UPDATE:
- newEffect = ParameterEffectKind.UPDATE_LITERAL;
- break;
- }
-
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Effect(), newEffect));
- }
-
- if (parameterRuleObject.getDefaultValue() != null) {
- final ValueSpecification currentDefault = parameter.getDefaultValue();
- Value newDefault = parameterRuleObject.getDefaultValue().getDefault();
- IEditCommandRequest request = new UmlParameterSwitch<IEditCommandRequest>() {
- @Override
- public SetRequest caseBooleanValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.BooleanValue object) {
- boolean booleanValue = object.getLiteralBoolean() == BooleanLiterals.TRUE;
- if (currentDefault instanceof LiteralBoolean) {
- return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralBoolean_Value(), booleanValue);
- } else {
- // TODO: Destroy previous defaultValue if not null?
- LiteralBoolean literalBoolean = UMLFactory.eINSTANCE.createLiteralBoolean();
- literalBoolean.setValue(booleanValue);
- return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalBoolean);
- }
- }
-
- @Override
- public SetRequest caseStringValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.StringValue object) {
- String stringValue = object.getLiteralString();
- if (currentDefault instanceof LiteralString) {
- return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralString_Value(), stringValue);
- } else {
- // TODO: Destroy previous defaultValue if not null?
- LiteralString literalString = UMLFactory.eINSTANCE.createLiteralString();
- literalString.setValue(stringValue);
- return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalString);
- }
- }
-
- @Override
- public SetRequest caseIntValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.IntValue object) {
- Integer integerValue;
- try {
- integerValue = object.getLiteralInteger();
- } catch (NumberFormatException ex) {
- integerValue = 0;
- }
-
- if (currentDefault instanceof LiteralInteger) {
- return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralInteger_Value(), integerValue);
- } else {
- // TODO: Destroy previous defaultValue if not null?
- LiteralInteger literalInteger = UMLFactory.eINSTANCE.createLiteralInteger();
- literalInteger.setValue(integerValue);
- return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalInteger);
- }
- }
-
- @Override
- public SetRequest caseRealValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.RealValue object) {
- Double realValue;
- String literalDouble = "" + object.getInteger() + '.' + object.getFraction();
- try {
- realValue = Double.parseDouble(literalDouble);
- } catch (NumberFormatException ex) {
- realValue = 0.;
- }
-
- if (currentDefault instanceof LiteralReal) {
- return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralReal_Value(), realValue);
- } else {
- // TODO: Destroy previous defaultValue if not null?
- LiteralReal literalReal = UMLFactory.eINSTANCE.createLiteralReal();
- literalReal.setValue(realValue);
- return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalReal);
- }
- }
-
- @Override
- public SetRequest caseNullValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.NullValue object) {
- if (parameter.getDefaultValue() instanceof LiteralNull) {
- return null;
- }
-
- LiteralNull literalNull = UMLFactory.eINSTANCE.createLiteralNull();
- return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalNull);
- }
-
- @Override
- public IEditCommandRequest caseNoValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.NoValue object) {
- if (parameter.getDefaultValue() == null) {
- return null;
- }
-
- return new DestroyElementRequest(parameter.getDefaultValue(), false);
- }
- }.doSwitch(newDefault);
-
-
- if (request != null) {
- requests.add(request);
- }
- }
-
- String newName = parameterRuleObject.getName();
- requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Name(), newName));
-
- return requests;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof Parameter) {
- return UMLParameterEditorUtil.getLabel((Parameter) editedObject).trim();
- }
- return "not a Parameter"; //$NON-NLS-1$
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.internal.UmlParameterActivator; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.BooleanLiterals; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.DirectionRule; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ParameterRule; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.Value; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.VisibilityRule; +import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.util.UmlParameterSwitch; +import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration; +import org.eclipse.uml2.uml.LiteralBoolean; +import org.eclipse.uml2.uml.LiteralInteger; +import org.eclipse.uml2.uml.LiteralNull; +import org.eclipse.uml2.uml.LiteralReal; +import org.eclipse.uml2.uml.LiteralString; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; +import org.eclipse.uml2.uml.ParameterEffectKind; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +import com.google.inject.Injector; + + +public class ParameterXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration { + + @Override + public Injector getInjector() { + return UmlParameterActivator.getInstance().getInjector(UmlParameterActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PARAMETER_XTEXT_UMLPARAMETER); + } + + @Override + protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) { + CompositeCommand cc = new CompositeCommand("Set values for Parameter"); //$NON-NLS-1$ + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(umlObject); + if (provider != null) { + + // Manage the name or the label set + if (!(xtextObject instanceof Parameter)) { + + final ParameterRule parameterRuleObject = (ParameterRule) xtextObject; + final Parameter parameter = (Parameter) umlObject; + String newName = parameterRuleObject.getName(); + + ICommand setNameCommand = null; + if(InternationalizationPreferencesUtils.getInternationalizationPreference(parameter) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(parameter)){ + final ModelSet modelSet = (ModelSet)parameter.eResource().getResourceSet(); + setNameCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), parameter, newName, null)); + }else{ + final SetRequest setNameRequest = new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); + setNameCommand = provider.getEditCommand(setNameRequest); + } + cc.add(setNameCommand); + } + + ICommand editCommand = null; + for (IEditCommandRequest current : getRequests(umlObject, xtextObject)) { + editCommand = provider.getEditCommand(current); + + if (editCommand != null && editCommand.canExecute()) { + cc.add(editCommand); + } + } + } + return cc; + } + + /** + * Returns the list of requests to update the {@link #parameter} + * + * @return + * the list of requests to update the {@link #parameter} + */ + protected List<IEditCommandRequest> getRequests(EObject modelObject, EObject xtextObject) { + List<IEditCommandRequest> requests = new ArrayList<IEditCommandRequest>(); + + + // first: retrieves / determines if the xtextObject is a CollaborationUseRule object + EObject modifiedObject = xtextObject; + if (!(modelObject instanceof Parameter)) { + return requests; + } + while (xtextObject != null && !(xtextObject instanceof ParameterRule)) { + modifiedObject = modifiedObject.eContainer(); + } + if (modifiedObject == null) { + return requests; + } + + final ParameterRule parameterRuleObject = (ParameterRule) xtextObject; + + final Parameter parameter = (Parameter) modelObject; + + // Retrieves the information to be populated in modelObject + if (parameterRuleObject.getModifiers() != null) { + /** the new value for isException */ + boolean newIsException = false; + + /** the new value for isStream */ + boolean newIsStream = false; + + /** the new value for isOrdered */ + boolean newIsOrdered = false; + + /** the new value for isUnique */ + boolean newIsUnique = false; + + for (org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ModifierSpecification modifier : parameterRuleObject.getModifiers().getValues()) { + switch (modifier.getValue()) { + case ORDERED: + newIsOrdered = true; + break; + case UNIQUE: + newIsUnique = true; + break; + case EXCEPTION: + newIsException = true; + break; + case STREAM: + newIsStream = true; + break; + default: + break; + } + } + + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsException(), newIsException)); + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsStream(), newIsStream)); + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered(), newIsOrdered)); + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), newIsUnique)); + } + + if (parameterRuleObject.getMultiplicity() != null) { + /** the new lowerBound */ + int newLowerBound = 1; + + /** the new upperBound */ + int newUpperBound = 1; + + if (parameterRuleObject.getMultiplicity().getBounds().size() == 1) { + String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue(); + if (tempBound.equals("*")) { //$NON-NLS-1$ + newLowerBound = 0; + newUpperBound = -1; + } else { + newLowerBound = new Integer(tempBound).intValue(); + newUpperBound = new Integer(tempBound).intValue(); + } + } else { // size == 2 + String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue(); + newLowerBound = new Integer(tempBound).intValue(); + tempBound = parameterRuleObject.getMultiplicity().getBounds().get(1).getValue(); + if (tempBound.equals("*")) { //$NON-NLS-1$ + newUpperBound = -1; + } else { + newUpperBound = new Integer(tempBound).intValue(); + } + } + + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), newLowerBound)); + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), newUpperBound)); + } + + boolean setType = false; + TypeRule typeRule = parameterRuleObject.getType(); + Type newType = null; + if (parameterRuleObject.isTypeUndefined()) { + setType = true; + } else if (typeRule != null) { + newType = typeRule.getType(); + setType = newType != parameter.getType(); + } // Else: no change + + if (setType) { + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getTypedElement_Type(), newType)); + } + + if (parameterRuleObject.getVisibility() != null) { + org.eclipse.uml2.uml.VisibilityKind newVisibility; + + VisibilityRule visibility = parameterRuleObject.getVisibility(); + + newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL; + + switch (visibility.getVisibility()) { + case PUBLIC: + newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL; + break; + case PACKAGE: + newVisibility = org.eclipse.uml2.uml.VisibilityKind.PACKAGE_LITERAL; + break; + case PRIVATE: + newVisibility = org.eclipse.uml2.uml.VisibilityKind.PRIVATE_LITERAL; + break; + case PROTECTED: + newVisibility = org.eclipse.uml2.uml.VisibilityKind.PROTECTED_LITERAL; + break; + default: + break; + } + + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility)); + } + + if (parameterRuleObject.getDirection() != null) { + DirectionRule direction = parameterRuleObject.getDirection(); + + ParameterDirectionKind newDirection = ParameterDirectionKind.IN_LITERAL; + + switch (direction.getDirection()) { + case IN: + newDirection = ParameterDirectionKind.IN_LITERAL; + break; + case OUT: + newDirection = ParameterDirectionKind.OUT_LITERAL; + break; + case INOUT: + newDirection = ParameterDirectionKind.INOUT_LITERAL; + break; + case RETURN: + newDirection = ParameterDirectionKind.RETURN_LITERAL; + break; + } + + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Direction(), newDirection)); + } + + if (parameterRuleObject.getEffect() != null) { + /** the new effect for the parameter */ + ParameterEffectKind newEffect = ParameterEffectKind.CREATE_LITERAL; + + switch (parameterRuleObject.getEffect().getEffectKind()) { + case CREATE: + newEffect = ParameterEffectKind.CREATE_LITERAL; + break; + case DELETE: + newEffect = ParameterEffectKind.DELETE_LITERAL; + break; + case READ: + newEffect = ParameterEffectKind.READ_LITERAL; + break; + case UPDATE: + newEffect = ParameterEffectKind.UPDATE_LITERAL; + break; + } + + requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Effect(), newEffect)); + } + + if (parameterRuleObject.getDefaultValue() != null) { + final ValueSpecification currentDefault = parameter.getDefaultValue(); + Value newDefault = parameterRuleObject.getDefaultValue().getDefault(); + IEditCommandRequest request = new UmlParameterSwitch<IEditCommandRequest>() { + @Override + public SetRequest caseBooleanValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.BooleanValue object) { + boolean booleanValue = object.getLiteralBoolean() == BooleanLiterals.TRUE; + if (currentDefault instanceof LiteralBoolean) { + return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralBoolean_Value(), booleanValue); + } else { + // TODO: Destroy previous defaultValue if not null? + LiteralBoolean literalBoolean = UMLFactory.eINSTANCE.createLiteralBoolean(); + literalBoolean.setValue(booleanValue); + return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalBoolean); + } + } + + @Override + public SetRequest caseStringValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.StringValue object) { + String stringValue = object.getLiteralString(); + if (currentDefault instanceof LiteralString) { + return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralString_Value(), stringValue); + } else { + // TODO: Destroy previous defaultValue if not null? + LiteralString literalString = UMLFactory.eINSTANCE.createLiteralString(); + literalString.setValue(stringValue); + return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalString); + } + } + + @Override + public SetRequest caseIntValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.IntValue object) { + Integer integerValue; + try { + integerValue = object.getLiteralInteger(); + } catch (NumberFormatException ex) { + integerValue = 0; + } + + if (currentDefault instanceof LiteralInteger) { + return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralInteger_Value(), integerValue); + } else { + // TODO: Destroy previous defaultValue if not null? + LiteralInteger literalInteger = UMLFactory.eINSTANCE.createLiteralInteger(); + literalInteger.setValue(integerValue); + return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalInteger); + } + } + + @Override + public SetRequest caseRealValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.RealValue object) { + Double realValue; + String literalDouble = "" + object.getInteger() + '.' + object.getFraction(); + try { + realValue = Double.parseDouble(literalDouble); + } catch (NumberFormatException ex) { + realValue = 0.; + } + + if (currentDefault instanceof LiteralReal) { + return new SetRequest(currentDefault, UMLPackage.eINSTANCE.getLiteralReal_Value(), realValue); + } else { + // TODO: Destroy previous defaultValue if not null? + LiteralReal literalReal = UMLFactory.eINSTANCE.createLiteralReal(); + literalReal.setValue(realValue); + return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalReal); + } + } + + @Override + public SetRequest caseNullValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.NullValue object) { + if (parameter.getDefaultValue() instanceof LiteralNull) { + return null; + } + + LiteralNull literalNull = UMLFactory.eINSTANCE.createLiteralNull(); + return new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_DefaultValue(), literalNull); + } + + @Override + public IEditCommandRequest caseNoValue(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.NoValue object) { + if (parameter.getDefaultValue() == null) { + return null; + } + + return new DestroyElementRequest(parameter.getDefaultValue(), false); + } + }.doSwitch(newDefault); + + + if (request != null) { + requests.add(request); + } + } + + return requests; + } + + /** + * {@inheritDoc} + */ + @Override + public String getTextToEdit(Object editedObject) { + if (editedObject instanceof Parameter) { + return UMLParameterEditorUtil.getLabel((Parameter) editedObject).trim(); + } + return "not a Parameter"; //$NON-NLS-1$ + } + +} diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/UMLParameterEditorUtil.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/UMLParameterEditorUtil.java index f3c949f1b5b..842aad2c984 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/UMLParameterEditorUtil.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/UMLParameterEditorUtil.java @@ -1,182 +1,184 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.papyrus.uml.tools.utils.ParameterUtil;
-import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterEffectKind;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.util.UMLSwitch;
-
-/**
- *
- * This class provides methods to get the label to display for a Parameter
- *
- *
- */
-public class UMLParameterEditorUtil extends ParameterUtil {
-
- /**
- * Returns the string used to represent this parameter
- *
- * @param parameter
- * a parameter
- * @return
- * the string used to represent this parameter
- */
- public static String getLabel(Parameter parameter) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" "); //$NON-NLS-1$
- buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
-
- // direction
- buffer.append(" "); //$NON-NLS-1$
- buffer.append(parameter.getDirection().getLiteral());
-
- // name
- buffer.append(" "); //$NON-NLS-1$
- if (parameter.getName() != null) {
- buffer.append(parameter.getName());
- }
-
- // type
- if (parameter.getType() != null) {
- EList<Namespace> namespaces = parameter.allNamespaces();
- buffer.append(" : " + getTypeLabel(parameter.getType(), namespaces.get(namespaces.size() - 1))); //$NON-NLS-1$
- } else {
- buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME); //$NON-NLS-1$
- }
-
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
- if (!multiplicity.trim().equals("[1]")) { //$NON-NLS-1$
- buffer.append(multiplicity);
- }
-
- // property modifiers
- buffer.append(" ");
- buffer.append(ParameterUtil.getModifiersAsString(parameter, false));
- buffer.append(getEffectAsString(parameter));
-
- // default value
- if (parameter.getDefaultValue() != null) {
- buffer.append(" = "); //$NON-NLS-1$
- String defaultValue = new UMLSwitch<String>() {
- @Override
- public String caseLiteralBoolean(org.eclipse.uml2.uml.LiteralBoolean object) {
- return Boolean.toString(object.booleanValue());
- }
-
- @Override
- public String caseLiteralInteger(org.eclipse.uml2.uml.LiteralInteger object) {
- return Integer.toString(object.integerValue());
- }
-
- @Override
- public String caseLiteralNull(org.eclipse.uml2.uml.LiteralNull object) {
- return "null"; //$NON-NLS-1$
- }
-
- @Override
- public String caseLiteralString(org.eclipse.uml2.uml.LiteralString object) {
- return "\"" + object.stringValue() + "\"";
- }
-
- @Override
- public String caseLiteralReal(org.eclipse.uml2.uml.LiteralReal object) {
- return Double.toString(object.getValue());
- }
-
- @Override
- public String caseLiteralUnlimitedNatural(org.eclipse.uml2.uml.LiteralUnlimitedNatural object) {
- return object.getValue() < 0 ? "*" : Integer.toString(object.getValue());
- }
-
- }.doSwitch(parameter.getDefaultValue());
-
- buffer.append(defaultValue);
- }
- return buffer.toString();
-
- }
-
- /**
- * Returns the effect of the parameter as a String
- *
- * @param parameter
- * the parameter
- * @return
- * The effect of the parameter as a String
- */
- public static String getEffectAsString(Parameter parameter) {
- StringBuffer buffer = new StringBuffer();
- ParameterEffectKind effect = parameter.getEffect();
- buffer.append(effect.toString());
-
- if (!buffer.toString().equals("")) { //$NON-NLS-1$
- buffer.insert(0, "{effect: "); //$NON-NLS-1$
- buffer.append("}"); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- /**
- * Returns the name of the type with its qualified name
- *
- * @param type
- * a type
- * @return
- * the name of the type with its qualified name
- */
- public static String getTypeLabel(Type type, Namespace model) {
- String label = ""; //$NON-NLS-1$
-
- List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages());
-
- List<Package> visitedPackages = new ArrayList<Package>();
- Package currentPackage = type.getNearestPackage();
-
- boolean rootFound = false;
-
- while (currentPackage != null && !rootFound) {
- visitedPackages.add(currentPackage);
- if (importedPackages.contains(currentPackage) || currentPackage == model) {
- rootFound = true;
- }
- Element owner = currentPackage.getOwner();
- while (owner != null && !(owner instanceof Package)) {
- owner = owner.getOwner();
- }
-
- currentPackage = owner != null ? (Package) owner : null;
- }
-
- for (int i = visitedPackages.size() - 1; i >= 0; i--) {
- label += visitedPackages.get(i).getName() + "::"; //$NON-NLS-1$
- }
-
- return label + type.getName();
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.papyrus.uml.tools.utils.ParameterUtil; +import org.eclipse.papyrus.uml.tools.utils.TypeUtil; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterEffectKind; +import org.eclipse.uml2.uml.Type; +import org.eclipse.uml2.uml.util.UMLSwitch; + +/** + * + * This class provides methods to get the label to display for a Parameter + * + * + */ +public class UMLParameterEditorUtil extends ParameterUtil { + + /** + * Returns the string used to represent this parameter + * + * @param parameter + * a parameter + * @return + * the string used to represent this parameter + */ + public static String getLabel(Parameter parameter) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); //$NON-NLS-1$ + buffer.append(NamedElementUtil.getVisibilityAsSign(parameter)); + + // direction + buffer.append(" "); //$NON-NLS-1$ + buffer.append(parameter.getDirection().getLiteral()); + + // name + buffer.append(" "); //$NON-NLS-1$ + if (parameter.getName() != null) { + buffer.append(UMLLabelInternationalization.getInstance().getLabel(parameter)); + } + + // type + if (parameter.getType() != null) { + EList<Namespace> namespaces = parameter.allNamespaces(); + buffer.append(" : " + getTypeLabel(parameter.getType(), namespaces.get(namespaces.size() - 1))); //$NON-NLS-1$ + } else { + buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME); //$NON-NLS-1$ + } + + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter); + if (!multiplicity.trim().equals("[1]")) { //$NON-NLS-1$ + buffer.append(multiplicity); + } + + // property modifiers + buffer.append(" "); + buffer.append(ParameterUtil.getModifiersAsString(parameter, false)); + buffer.append(getEffectAsString(parameter)); + + // default value + if (parameter.getDefaultValue() != null) { + buffer.append(" = "); //$NON-NLS-1$ + String defaultValue = new UMLSwitch<String>() { + @Override + public String caseLiteralBoolean(org.eclipse.uml2.uml.LiteralBoolean object) { + return Boolean.toString(object.booleanValue()); + } + + @Override + public String caseLiteralInteger(org.eclipse.uml2.uml.LiteralInteger object) { + return Integer.toString(object.integerValue()); + } + + @Override + public String caseLiteralNull(org.eclipse.uml2.uml.LiteralNull object) { + return "null"; //$NON-NLS-1$ + } + + @Override + public String caseLiteralString(org.eclipse.uml2.uml.LiteralString object) { + return "\"" + object.stringValue() + "\""; + } + + @Override + public String caseLiteralReal(org.eclipse.uml2.uml.LiteralReal object) { + return Double.toString(object.getValue()); + } + + @Override + public String caseLiteralUnlimitedNatural(org.eclipse.uml2.uml.LiteralUnlimitedNatural object) { + return object.getValue() < 0 ? "*" : Integer.toString(object.getValue()); + } + + }.doSwitch(parameter.getDefaultValue()); + + buffer.append(defaultValue); + } + return buffer.toString(); + + } + + /** + * Returns the effect of the parameter as a String + * + * @param parameter + * the parameter + * @return + * The effect of the parameter as a String + */ + public static String getEffectAsString(Parameter parameter) { + StringBuffer buffer = new StringBuffer(); + ParameterEffectKind effect = parameter.getEffect(); + buffer.append(effect.toString()); + + if (!buffer.toString().equals("")) { //$NON-NLS-1$ + buffer.insert(0, "{effect: "); //$NON-NLS-1$ + buffer.append("}"); //$NON-NLS-1$ + } + return buffer.toString(); + } + + /** + * Returns the name of the type with its qualified name + * + * @param type + * a type + * @return + * the name of the type with its qualified name + */ + public static String getTypeLabel(Type type, Namespace model) { + String label = ""; //$NON-NLS-1$ + + List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages()); + + List<Package> visitedPackages = new ArrayList<Package>(); + Package currentPackage = type.getNearestPackage(); + + boolean rootFound = false; + + while (currentPackage != null && !rootFound) { + visitedPackages.add(currentPackage); + if (importedPackages.contains(currentPackage) || currentPackage == model) { + rootFound = true; + } + Element owner = currentPackage.getOwner(); + while (owner != null && !(owner instanceof Package)) { + owner = owner.getOwner(); + } + + currentPackage = owner != null ? (Package) owner : null; + } + + for (int i = visitedPackages.size() - 1; i >= 0; i--) { + label += visitedPackages.get(i).getName() + "::"; //$NON-NLS-1$ + } + + return label + type.getName(); + } +} diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/META-INF/MANIFEST.MF index e03d334cfa9..bfc1e4efdf5 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/META-INF/MANIFEST.MF @@ -20,7 +20,9 @@ Require-Bundle: org.eclipse.xtext.ui.shared;bundle-version="[2.10.0,3.0.0)", org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.apache.log4j;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.uml.alf.common.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java index 9ee202006f0..1d8616c1f5e 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java @@ -9,7 +9,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 465198 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 465198, 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.textedit.port.xtext.ui.contribution; @@ -24,9 +24,13 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.uml.alf.naming.ALFIDConverter; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.textedit.port.xtext.ui.internal.UmlPortActivator; import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.BooleanLiterals; import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.ModifierSpecification; @@ -294,8 +298,14 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor ICommand setIsConjugatedCommand = provider.getEditCommand(setIsConjugatedRequest); updateCommand.add(setIsConjugatedCommand); - SetRequest setNameRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); - ICommand setNameCommand = provider.getEditCommand(setNameRequest); + ICommand setNameCommand = null; + if(InternationalizationPreferencesUtils.getInternationalizationPreference(property) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(property)){ + final ModelSet modelSet = (ModelSet)property.eResource().getResourceSet(); + setNameCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), property, newName, null)); + }else{ + SetRequest setNameRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); + setNameCommand = provider.getEditCommand(setNameRequest); + } updateCommand.add(setNameCommand); return updateCommand; diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF index 9852f181d72..12b2af3e63c 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF @@ -20,7 +20,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.property.xtext;bundle-version=" org.apache.log4j;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.alf.common.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java index 0cc04c7d43c..4e5ad2dd23c 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java @@ -9,7 +9,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * FAUVERGUE Nicolas (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 465198 + * FAUVERGUE Nicolas (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 465198, 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.textedit.property.xtext.ui.contributions; @@ -24,9 +24,13 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.uml.alf.naming.ALFIDConverter; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.textedit.property.xtext.ui.internal.UmlPropertyActivator; import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.BooleanLiterals; import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.ModifierSpecification; @@ -287,8 +291,14 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd ICommand setIsDerivedCommand = provider.getEditCommand(setIsDerivedRequest); updateCommand.add(setIsDerivedCommand); - SetRequest setNameRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); - ICommand setNameCommand = provider.getEditCommand(setNameRequest); + ICommand setNameCommand = null; + if (InternationalizationPreferencesUtils.getInternationalizationPreference(property) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(property)) { + final ModelSet modelSet = (ModelSet) property.eResource().getResourceSet(); + setNameCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), property, newName, null)); + } else { + final SetRequest setNameRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Name(), newName); + setNameCommand = provider.getEditCommand(setNameRequest); + } updateCommand.add(setNameCommand); return updateCommand; diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF index cb0035d4856..946fe1b1ee7 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF @@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.state.xtext;bundle-version="[2. org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.alf.common.ui;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-Version: 2.0.0.qualifier Bundle-ManifestVersion: 2 diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contributions/StateEditorConfigurationContribution.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contributions/StateEditorConfigurationContribution.java index 039754a3d06..3e84f0c2436 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contributions/StateEditorConfigurationContribution.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/src/org/eclipse/papyrus/uml/textedit/state/xtext/ui/contributions/StateEditorConfigurationContribution.java @@ -1,388 +1,399 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.state.xtext.ui.contributions;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.uml.textedit.state.xtext.ui.contentassist.UmlStateProposalProvider;
-import org.eclipse.papyrus.uml.textedit.state.xtext.ui.internal.UmlStateActivator;
-import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.BehaviorKind;
-import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.StateRule;
-import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.OpaqueBehavior;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-import com.google.inject.Injector;
-
-/**
- * @author CEA LIST
- *
- * This class is used for contribution to the Papyrus extension point
- * DirectEditor. It is used for the integration of an xtext generated
- * editor, for States of UML StateMachines.
- *
- */
-public class StateEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration implements
- ICustomDirectEditorConfiguration {
-
- private static final String EMPTY = ""; //$NON-NLS-1$
-
- private static final String ACTIVITY = "Activity"; //$NON-NLS-1$
-
- private StateMachine newSubmachine = null;
-
- private String newStateName;
-
- private String newEntryName = null;
-
- private BehaviorKind newEntryKind;
-
- private String newDoName = null;
-
- private BehaviorKind newDoKind;
-
- private String newExitName = null;
-
- private BehaviorKind newExitKind;
-
- private enum BehaviorRole_Local {
- ENTRY, DO, EXIT
- }
-
- @Override
- public int getStyle() {
- return SWT.MULTI;
- }
-
- @Override
- public Injector getInjector() {
- return UmlStateActivator.getInstance().getInjector(
- UmlStateActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_STATE_XTEXT_UMLSTATE);
- }
-
- @Override
- protected ICommand getParseCommand(EObject modelObject, EObject xtextObject) {
- State state = (State) modelObject;
- // first: retrieves / determines if the xtextObject is a StateRule
- // object
- EObject modifiedObject = xtextObject;
- if (!(modelObject instanceof State)) {
- return UnexecutableCommand.INSTANCE;
- }
- while (xtextObject != null && !(xtextObject instanceof StateRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if (modifiedObject == null) {
- return UnexecutableCommand.INSTANCE;
- }
- StateRule stateRuleObject = (StateRule) xtextObject;
- // Retrieves the information to be populated in modelObject
- newStateName = stateRuleObject.getName();
- newSubmachine = null;
- newEntryName = EMPTY;
- newDoName = EMPTY;
- newExitName = EMPTY;
-
- if (stateRuleObject.getSubmachine() != null) {
- newSubmachine = stateRuleObject.getSubmachine().getSubmachine();
- }
-
- if (stateRuleObject.getEntry() != null) {
- newEntryKind = stateRuleObject.getEntry().getKind();
- if (stateRuleObject.getEntry().getBehaviorName() != null) {
- newEntryName = stateRuleObject.getEntry().getBehaviorName();
- }
- }
-
- if (stateRuleObject.getDo() != null) {
- newDoKind = stateRuleObject.getDo().getKind();
- if (stateRuleObject.getDo().getBehaviorName() != null) {
- newDoName = stateRuleObject.getDo().getBehaviorName();
- }
- }
-
- if (stateRuleObject.getExit() != null) {
- newExitKind = stateRuleObject.getExit().getKind();
- if (stateRuleObject.getExit().getBehaviorName() != null) {
- newExitName = stateRuleObject.getExit().getBehaviorName();
- }
- }
- return new UpdateUMLStateCommand(state);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration
- * #getTextToEdit(java.lang.Object)
- */
- @Override
- public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof State) {
- State state = (State) editedObject;
- String textToEdit = EMPTY;
-
- // name
- textToEdit = textToEdit + state.getName();
-
- if (state.isSubmachineState()) {
- textToEdit += " : " + UmlStateProposalProvider.getSubmachineLabel(state.getSubmachine());
- }
-
- // entryActivity
- if (state.getEntry() != null) {
- String kind = behaviorKindAsString(state.getEntry());
- textToEdit = textToEdit + "\nentry " + kind + " " + state.getEntry().getName();
- }
-
- // doActivity
- if (state.getDoActivity() != null) {
- String kind = behaviorKindAsString(state.getDoActivity());
- textToEdit = textToEdit + "\ndo " + kind + " " + state.getDoActivity().getName();
- }
-
- // exitActivity
- if (state.getExit() != null) {
- String kind = behaviorKindAsString(state.getExit());
- textToEdit = textToEdit + "\nexit " + kind + " " + state.getExit().getName();
- }
-
- return textToEdit;
- }
-
- return "not a State";
- }
-
- /**
- * @author CEA LIST
- *
- * A command for updating the context UML model
- */
- protected class UpdateUMLStateCommand extends AbstractTransactionalCommand {
-
- private static final String STATE_UPDATE_CMD = "State Update"; //$NON-NLS-1$
-
- private State state;
-
- public UpdateUMLStateCommand(State state) {
- super(StateEditorConfigurationContribution.getEditingDomain(state), STATE_UPDATE_CMD,
- getWorkspaceFiles(state));
- this.state = state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.
- * AbstractTransactionalCommand
- * #doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor ,
- * org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
-
- state.setName(newStateName);
- state.setSubmachine(newSubmachine);
- state.setEntry(updateOrCreateBehavior(BehaviorRole_Local.ENTRY, newEntryKind, newEntryName));
- state.setDoActivity(updateOrCreateBehavior(BehaviorRole_Local.DO, newDoKind, newDoName));
- state.setExit(updateOrCreateBehavior(BehaviorRole_Local.EXIT, newExitKind, newExitName));
- return CommandResult.newOKCommandResult(state);
- }
-
-
- private Behavior updateOrCreateBehavior(BehaviorRole_Local role, BehaviorKind kind, String behaviorName) {
- Behavior behavior = null;
- switch (role) {
- case DO:
- behavior = state.getDoActivity();
- if (behavior != null) {
- if (behaviorName.equals(EMPTY)) {
- // behavior needs to be deleted
- state.setDoActivity(null);
- behavior.destroy();
- behavior = null;
- } else {
- if (behaviorKindAsBehaviorKind(behavior) != kind) {
- // behavior needs to deleted, and a new one needs to be
- // created
- state.setDoActivity(null);
- behavior.destroy();
- behavior = createBehavior(kind, behaviorName);
- } else {
- // Behavior simply needs to be renamed
- behavior.setName(behaviorName);
- }
- }
- } else {
- if (behaviorName.equals(EMPTY)) {
- // nothing needs to be done
- } else {
- // behavior needs to be created
- behavior = createBehavior(kind, behaviorName);
- }
- }
- break;
-
- case ENTRY:
- behavior = state.getEntry();
- if (behavior != null) {
- if (behaviorName.equals(EMPTY)) {
- // behavior needs to be deleted
- state.setEntry(null);
- behavior.destroy();
- behavior = null;
- } else {
- if (behaviorKindAsBehaviorKind(behavior) != kind) {
- // behavior needs to deleted, and a new one needs to be
- // created
- state.setEntry(null);
- behavior.destroy();
- behavior = createBehavior(kind, behaviorName);
- } else {
- // Behavior simply needs to be renamed
- behavior.setName(behaviorName);
- }
- }
- } else {
- if (behaviorName.equals(EMPTY)) {
- // nothing needs to be done
- } else {
- // behavior needs to be created
- behavior = createBehavior(kind, behaviorName);
- }
- }
- break;
-
- case EXIT:
- behavior = state.getExit();
- if (behavior != null) {
- if (behaviorName.equals(EMPTY)) {
- // behavior needs to be deleted
- state.setExit(null);
- behavior.destroy();
- behavior = null;
- } else {
- if (behaviorKindAsBehaviorKind(behavior) != kind) {
- // behavior needs to deleted, and a new one needs to be
- // created
- state.setExit(null);
- behavior.destroy();
- behavior = createBehavior(kind, behaviorName);
- } else {
- // Behavior simply needs to be renamed
- behavior.setName(behaviorName);
- }
- }
- } else {
- if (behaviorName.equals(EMPTY)) {
- // nothing needs to be done
- } else {
- // behavior needs to be created
- behavior = createBehavior(kind, behaviorName);
- }
- }
- break;
-
- default:
- break;
- }
-
- return behavior;
- }
-
- }
-
- static TransactionalEditingDomain getEditingDomain(EObject context) {
- try {
- return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
- } catch (ServiceException ex) {
- ex.printStackTrace(System.err);
- }
- return null;
- }
-
- private String behaviorKindAsString(Behavior b) {
- if (b instanceof Activity) {
- return ACTIVITY;
- }
- if (b instanceof StateMachine) {
- return "StateMachine";
- }
- if (b instanceof OpaqueBehavior) {
- return "OpaqueBehavior";
- }
- return EMPTY;
- }
-
- private BehaviorKind behaviorKindAsBehaviorKind(Behavior b) {
- if (b instanceof Activity) {
- return BehaviorKind.ACTIVITY;
- }
- if (b instanceof StateMachine) {
- return BehaviorKind.STATE_MACHINE;
- }
- if (b instanceof OpaqueBehavior) {
- return BehaviorKind.OPAQUE_BEHAVIOR;
- }
-
- return BehaviorKind.OPAQUE_BEHAVIOR;
- }
-
-
- private Behavior createBehavior(BehaviorKind kind, String name) {
-
- if (kind == null) {
- return null;
- }
-
- Behavior behavior = null;
-
- switch (kind) {
- case ACTIVITY:
- behavior = UMLFactory.eINSTANCE.createActivity();
- break;
-
- case OPAQUE_BEHAVIOR:
- behavior = UMLFactory.eINSTANCE.createOpaqueBehavior();
- break;
-
- case STATE_MACHINE:
- behavior = UMLFactory.eINSTANCE.createStateMachine();
- break;
-
- default:
- break;
- }
-
- behavior.setName(name);
-
- return behavior;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.textedit.state.xtext.ui.contributions; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.papyrus.uml.textedit.state.xtext.ui.contentassist.UmlStateProposalProvider; +import org.eclipse.papyrus.uml.textedit.state.xtext.ui.internal.UmlStateActivator; +import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.BehaviorKind; +import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.StateRule; +import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration; +import org.eclipse.swt.SWT; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.Behavior; +import org.eclipse.uml2.uml.OpaqueBehavior; +import org.eclipse.uml2.uml.State; +import org.eclipse.uml2.uml.StateMachine; +import org.eclipse.uml2.uml.UMLFactory; + +import com.google.inject.Injector; + +/** + * @author CEA LIST + * + * This class is used for contribution to the Papyrus extension point + * DirectEditor. It is used for the integration of an xtext generated + * editor, for States of UML StateMachines. + * + */ +public class StateEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration implements + ICustomDirectEditorConfiguration { + + private static final String EMPTY = ""; //$NON-NLS-1$ + + private static final String ACTIVITY = "Activity"; //$NON-NLS-1$ + + private StateMachine newSubmachine = null; + + private String newStateName; + + private String newEntryName = null; + + private BehaviorKind newEntryKind; + + private String newDoName = null; + + private BehaviorKind newDoKind; + + private String newExitName = null; + + private BehaviorKind newExitKind; + + private enum BehaviorRole_Local { + ENTRY, DO, EXIT + } + + @Override + public int getStyle() { + return SWT.MULTI; + } + + @Override + public Injector getInjector() { + return UmlStateActivator.getInstance().getInjector( + UmlStateActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_STATE_XTEXT_UMLSTATE); + } + + @Override + protected ICommand getParseCommand(EObject modelObject, EObject xtextObject) { + State state = (State) modelObject; + // first: retrieves / determines if the xtextObject is a StateRule + // object + EObject modifiedObject = xtextObject; + if (!(modelObject instanceof State)) { + return UnexecutableCommand.INSTANCE; + } + while (xtextObject != null && !(xtextObject instanceof StateRule)) { + modifiedObject = modifiedObject.eContainer(); + } + if (modifiedObject == null) { + return UnexecutableCommand.INSTANCE; + } + StateRule stateRuleObject = (StateRule) xtextObject; + // Retrieves the information to be populated in modelObject + newStateName = stateRuleObject.getName(); + newSubmachine = null; + newEntryName = EMPTY; + newDoName = EMPTY; + newExitName = EMPTY; + + if (stateRuleObject.getSubmachine() != null) { + newSubmachine = stateRuleObject.getSubmachine().getSubmachine(); + } + + if (stateRuleObject.getEntry() != null) { + newEntryKind = stateRuleObject.getEntry().getKind(); + if (stateRuleObject.getEntry().getBehaviorName() != null) { + newEntryName = stateRuleObject.getEntry().getBehaviorName(); + } + } + + if (stateRuleObject.getDo() != null) { + newDoKind = stateRuleObject.getDo().getKind(); + if (stateRuleObject.getDo().getBehaviorName() != null) { + newDoName = stateRuleObject.getDo().getBehaviorName(); + } + } + + if (stateRuleObject.getExit() != null) { + newExitKind = stateRuleObject.getExit().getKind(); + if (stateRuleObject.getExit().getBehaviorName() != null) { + newExitName = stateRuleObject.getExit().getBehaviorName(); + } + } + return new UpdateUMLStateCommand(state); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration + * #getTextToEdit(java.lang.Object) + */ + @Override + public String getTextToEdit(Object editedObject) { + if (editedObject instanceof State) { + State state = (State) editedObject; + String textToEdit = EMPTY; + + // name + if(InternationalizationPreferencesUtils.getInternationalizationPreference(state) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(state)){ + textToEdit = textToEdit + UMLLabelInternationalization.getInstance().getLabel(state); + }else{ + textToEdit = textToEdit + state.getName(); + } + + if (state.isSubmachineState()) { + textToEdit += " : " + UmlStateProposalProvider.getSubmachineLabel(state.getSubmachine()); + } + + // entryActivity + if (state.getEntry() != null) { + String kind = behaviorKindAsString(state.getEntry()); + textToEdit = textToEdit + "\nentry " + kind + " " + state.getEntry().getName(); + } + + // doActivity + if (state.getDoActivity() != null) { + String kind = behaviorKindAsString(state.getDoActivity()); + textToEdit = textToEdit + "\ndo " + kind + " " + state.getDoActivity().getName(); + } + + // exitActivity + if (state.getExit() != null) { + String kind = behaviorKindAsString(state.getExit()); + textToEdit = textToEdit + "\nexit " + kind + " " + state.getExit().getName(); + } + + return textToEdit; + } + + return "not a State"; + } + + /** + * @author CEA LIST + * + * A command for updating the context UML model + */ + protected class UpdateUMLStateCommand extends AbstractTransactionalCommand { + + private static final String STATE_UPDATE_CMD = "State Update"; //$NON-NLS-1$ + + private State state; + + public UpdateUMLStateCommand(State state) { + super(StateEditorConfigurationContribution.getEditingDomain(state), STATE_UPDATE_CMD, + getWorkspaceFiles(state)); + this.state = state; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command. + * AbstractTransactionalCommand + * #doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor , + * org.eclipse.core.runtime.IAdaptable) + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException { + + if(InternationalizationPreferencesUtils.getInternationalizationPreference(state) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(state)){ + UMLLabelInternationalization.getInstance().setLabel(state, newStateName, null); + }else{ + state.setName(newStateName); + } + state.setSubmachine(newSubmachine); + state.setEntry(updateOrCreateBehavior(BehaviorRole_Local.ENTRY, newEntryKind, newEntryName)); + state.setDoActivity(updateOrCreateBehavior(BehaviorRole_Local.DO, newDoKind, newDoName)); + state.setExit(updateOrCreateBehavior(BehaviorRole_Local.EXIT, newExitKind, newExitName)); + return CommandResult.newOKCommandResult(state); + } + + + private Behavior updateOrCreateBehavior(BehaviorRole_Local role, BehaviorKind kind, String behaviorName) { + Behavior behavior = null; + switch (role) { + case DO: + behavior = state.getDoActivity(); + if (behavior != null) { + if (behaviorName.equals(EMPTY)) { + // behavior needs to be deleted + state.setDoActivity(null); + behavior.destroy(); + behavior = null; + } else { + if (behaviorKindAsBehaviorKind(behavior) != kind) { + // behavior needs to deleted, and a new one needs to be + // created + state.setDoActivity(null); + behavior.destroy(); + behavior = createBehavior(kind, behaviorName); + } else { + // Behavior simply needs to be renamed + behavior.setName(behaviorName); + } + } + } else { + if (behaviorName.equals(EMPTY)) { + // nothing needs to be done + } else { + // behavior needs to be created + behavior = createBehavior(kind, behaviorName); + } + } + break; + + case ENTRY: + behavior = state.getEntry(); + if (behavior != null) { + if (behaviorName.equals(EMPTY)) { + // behavior needs to be deleted + state.setEntry(null); + behavior.destroy(); + behavior = null; + } else { + if (behaviorKindAsBehaviorKind(behavior) != kind) { + // behavior needs to deleted, and a new one needs to be + // created + state.setEntry(null); + behavior.destroy(); + behavior = createBehavior(kind, behaviorName); + } else { + // Behavior simply needs to be renamed + behavior.setName(behaviorName); + } + } + } else { + if (behaviorName.equals(EMPTY)) { + // nothing needs to be done + } else { + // behavior needs to be created + behavior = createBehavior(kind, behaviorName); + } + } + break; + + case EXIT: + behavior = state.getExit(); + if (behavior != null) { + if (behaviorName.equals(EMPTY)) { + // behavior needs to be deleted + state.setExit(null); + behavior.destroy(); + behavior = null; + } else { + if (behaviorKindAsBehaviorKind(behavior) != kind) { + // behavior needs to deleted, and a new one needs to be + // created + state.setExit(null); + behavior.destroy(); + behavior = createBehavior(kind, behaviorName); + } else { + // Behavior simply needs to be renamed + behavior.setName(behaviorName); + } + } + } else { + if (behaviorName.equals(EMPTY)) { + // nothing needs to be done + } else { + // behavior needs to be created + behavior = createBehavior(kind, behaviorName); + } + } + break; + + default: + break; + } + + return behavior; + } + + } + + static TransactionalEditingDomain getEditingDomain(EObject context) { + try { + return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context); + } catch (ServiceException ex) { + ex.printStackTrace(System.err); + } + return null; + } + + private String behaviorKindAsString(Behavior b) { + if (b instanceof Activity) { + return ACTIVITY; + } + if (b instanceof StateMachine) { + return "StateMachine"; + } + if (b instanceof OpaqueBehavior) { + return "OpaqueBehavior"; + } + return EMPTY; + } + + private BehaviorKind behaviorKindAsBehaviorKind(Behavior b) { + if (b instanceof Activity) { + return BehaviorKind.ACTIVITY; + } + if (b instanceof StateMachine) { + return BehaviorKind.STATE_MACHINE; + } + if (b instanceof OpaqueBehavior) { + return BehaviorKind.OPAQUE_BEHAVIOR; + } + + return BehaviorKind.OPAQUE_BEHAVIOR; + } + + + private Behavior createBehavior(BehaviorKind kind, String name) { + + if (kind == null) { + return null; + } + + Behavior behavior = null; + + switch (kind) { + case ACTIVITY: + behavior = UMLFactory.eINSTANCE.createActivity(); + break; + + case OPAQUE_BEHAVIOR: + behavior = UMLFactory.eINSTANCE.createOpaqueBehavior(); + break; + + case STATE_MACHINE: + behavior = UMLFactory.eINSTANCE.createStateMachine(); + break; + + default: + break; + } + + behavior.setName(name); + + return behavior; + } +} diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF index 6a29e7b902a..cf25a57e65c 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF @@ -8,7 +8,9 @@ Require-Bundle: org.eclipse.xtext.generator;bundle-version="[2.10.0,3.0.0)";reso org.eclipse.uml2.codegen.ecore;bundle-version="[2.1.0,3.0.0)", org.apache.log4j;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.uml.alf.common;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.textedit.state.xtext, org.eclipse.papyrus.uml.textedit.state.xtext.formatting, org.eclipse.papyrus.uml.textedit.state.xtext.generator, diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java index bd83643b68e..9d0b457892d 100755 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java @@ -9,6 +9,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.textedit.state.xtext.validation; @@ -17,6 +18,8 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.BehaviorKind; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.DoRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.EntryRule; @@ -65,7 +68,7 @@ public class UmlStateJavaValidator extends AbstractUmlStateJavaValidator { String newName = "" + stateRule.getName(); - if (alreadyUsedNames.contains("" + newName)) { + if (alreadyUsedNames.contains("" + newName) && InternationalizationPreferencesUtils.getInternationalizationPreference(stateRule)) { warning("Name " + newName + " is already used by another State in this Region", UmlStatePackage.eINSTANCE.getStateRule_Name()); } diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/META-INF/MANIFEST.MF index 5d779a43c24..140006c5785 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/META-INF/MANIFEST.MF +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/META-INF/MANIFEST.MF @@ -3,7 +3,10 @@ Require-Bundle: org.eclipse.papyrus.infra.services.edit;bundle-version="[2.0.0,3 org.eclipse.papyrus.uml.textedit.valuespecification.xtext;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.services.validation;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.uml.service.validation;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.uml.service.validation;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils, org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands Bundle-Vendor: %providerName diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java index a8e6e18e007..e20e9142ef7 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java @@ -22,10 +22,14 @@ import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand; import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule; import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralBooleanRule; import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralIntegerOrUnlimitedNaturalRule; @@ -541,12 +545,24 @@ public class ValueSpecificationSetCommand { } // Set the name if it was created - if (null != getName(abstractRule)) { - // Set the name by command - final ICommand setNameCommand = createSetNameCommand(valueSpecification, getName(abstractRule)); - if (null != setNameCommand - && setNameCommand.canExecute()) { - setAttributesCommand.add(setNameCommand); + final String newName = getName(abstractRule); + if (null != newName) { + if(InternationalizationPreferencesUtils.getInternationalizationPreference(valueSpecification) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(valueSpecification)){ + // Set the label by command + final ModelSet modelSet = (ModelSet)valueSpecification.eResource().getResourceSet(); + if (null != modelSet){ + final ICommand setLabelCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), valueSpecification, newName, null)); + if(null != setLabelCommand && setLabelCommand.canExecute()){ + setAttributesCommand.add(setLabelCommand); + } + } + }else{ + // Set the name by command + final ICommand setNameCommand = createSetNameCommand(valueSpecification, newName); + if (null != setNameCommand + && setNameCommand.canExecute()) { + setAttributesCommand.add(setNameCommand); + } } } @@ -693,6 +709,12 @@ public class ValueSpecificationSetCommand { } } } + + // Copy the label is existing + final String existingLabel = UMLLabelInternationalization.getInstance().getLabelWithoutUML((ValueSpecification)existingObject); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(existingObject) && null != existingLabel){ + UMLLabelInternationalization.getInstance().setLabel(newValueSpecification, existingLabel, null); + } } } @@ -777,11 +799,22 @@ public class ValueSpecificationSetCommand { final CompositeCommand setAttributesCommand = new CompositeCommand("Update Opaque Expression Command"); //$NON-NLS-1$ if (!name.isEmpty()) { - // Set the name by command - ICommand setNameCommand = createSetNameCommand(opaqueExpression, name); - if (null != setNameCommand - && setNameCommand.canExecute()) { - setAttributesCommand.add(setNameCommand); + if(InternationalizationPreferencesUtils.getInternationalizationPreference(opaqueExpression) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(opaqueExpression)){ + // Set the label by command + final ModelSet modelSet = (ModelSet)opaqueExpression.eResource().getResourceSet(); + if (null != modelSet){ + final ICommand setLabelCommand = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), opaqueExpression, name, null)); + if(null != setLabelCommand && setLabelCommand.canExecute()){ + setAttributesCommand.add(setLabelCommand); + } + } + }else{ + // Set the name by command + ICommand setNameCommand = createSetNameCommand(opaqueExpression, name); + if (null != setNameCommand + && setNameCommand.canExecute()) { + setAttributesCommand.add(setNameCommand); + } } } diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF index 697f7b0daec..8421fff1abb 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/META-INF/MANIFEST.MF @@ -3,7 +3,8 @@ Export-Package: org.eclipse.papyrus.uml.tools.utils Require-Bundle: org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.gmf.runtime.notation;bundle-version="[1.8.0,2.0.0)", - org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport, + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %pluginProvider Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java index 345a815ef08..124e850ed11 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java @@ -1,87 +1,89 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Collection;
-
-import org.eclipse.uml2.uml.CollaborationUse;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.CollaborationUse</code><BR>
- */
-public class CollaborationUseUtil {
-
- public final static String UNDEFINED_TYPE_NAME = "<Undefined>";
-
- /**
- * return the full label of the CollaborationUse, given UML2 specification.
- *
- * @return the string corresponding to the label of the CollaborationUse
- */
- public static String getLabel(CollaborationUse collaborationUse) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse));
-
- // name
- buffer.append(" ");
- buffer.append(collaborationUse.getName());
-
- // type
- if (collaborationUse.getType() != null) {
- buffer.append(": " + collaborationUse.getType().getName());
- } else {
- buffer.append(": " + UNDEFINED_TYPE_NAME);
- }
-
- return buffer.toString();
- }
-
- /**
- * return the custom label of the CollaborationUse, given UML2 specification and a custom style.
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the CollaborationUse
- */
- public static String getCustomLabel(CollaborationUse collaborationUse, Collection<String> maskValues) {
- StringBuffer buffer = new StringBuffer();
- // visibility
-
- buffer.append(" ");
- if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse));
- }
-
- // name
- if (maskValues.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(collaborationUse.getName());
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_TYPE)) {
- // type
- if (collaborationUse.getType() != null) {
- buffer.append(": " + collaborationUse.getType().getName());
- } else {
- buffer.append(": " + UNDEFINED_TYPE_NAME);
- }
- }
-
- return buffer.toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.CollaborationUse; + +/** + * Utility class for <code>org.eclipse.uml2.uml.CollaborationUse</code><BR> + */ +public class CollaborationUseUtil { + + public final static String UNDEFINED_TYPE_NAME = "<Undefined>"; + + /** + * return the full label of the CollaborationUse, given UML2 specification. + * + * @return the string corresponding to the label of the CollaborationUse + */ + public static String getLabel(CollaborationUse collaborationUse) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse)); + + // name + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(collaborationUse)); + + // type + if (collaborationUse.getType() != null) { + buffer.append(": " + UMLLabelInternationalization.getInstance().getLabel(collaborationUse.getType())); + } else { + buffer.append(": " + UNDEFINED_TYPE_NAME); + } + + return buffer.toString(); + } + + /** + * return the custom label of the CollaborationUse, given UML2 specification and a custom style. + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the CollaborationUse + */ + public static String getCustomLabel(CollaborationUse collaborationUse, Collection<String> maskValues) { + StringBuffer buffer = new StringBuffer(); + // visibility + + buffer.append(" "); + if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse)); + } + + // name + if (maskValues.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(collaborationUse)); + } + + if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { + // type + if (collaborationUse.getType() != null) { + buffer.append(": " + UMLLabelInternationalization.getInstance().getLabel(collaborationUse.getType())); + } else { + buffer.append(": " + UNDEFINED_TYPE_NAME); + } + } + + return buffer.toString(); + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ExtensionPointUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ExtensionPointUtil.java index 9bc808106a3..a5e695f9872 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ExtensionPointUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ExtensionPointUtil.java @@ -1,40 +1,42 @@ -/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi SCHNEKENBURGER (CEA LIST) Remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.tools.utils;
-
-import org.eclipse.uml2.uml.ExtensionPoint;
-
-/**
- * Utility class for {@link ExtensionPoint}
- */
-// @unused
-public class ExtensionPointUtil {
-
- /**
- * Returns the explanation for the extension point element
- *
- * @return the string defining explanation for the extension point element
- */
- // @unused
- public static String getExplanation(ExtensionPoint extensionPoint) {
- String explanation = "";
- final String name = ((extensionPoint.getName() != null) ? extensionPoint.getName() : "");
- int startIndexOfExplanation = name.lastIndexOf(":");
- if ((startIndexOfExplanation > 0) && (startIndexOfExplanation != name.length())) {
- explanation = name.substring(startIndexOfExplanation + 1).trim();
- }
- return explanation;
- }
-}
+/***************************************************************************** + * Copyright (c) 2008 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi SCHNEKENBURGER (CEA LIST) Remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.tools.utils; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.ExtensionPoint; + +/** + * Utility class for {@link ExtensionPoint} + */ +// @unused +public class ExtensionPointUtil { + + /** + * Returns the explanation for the extension point element + * + * @return the string defining explanation for the extension point element + */ + // @unused + public static String getExplanation(ExtensionPoint extensionPoint) { + String explanation = ""; + final String name = ((extensionPoint.getName() != null) ? UMLLabelInternationalization.getInstance().getLabel(extensionPoint) : ""); + int startIndexOfExplanation = name.lastIndexOf(":"); + if ((startIndexOfExplanation > 0) && (startIndexOfExplanation != name.length())) { + explanation = name.substring(startIndexOfExplanation + 1).trim(); + } + return explanation; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java index 505c672897f..16a8561ce1a 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java @@ -9,12 +9,14 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.tools.utils; import java.util.Collection; import java.util.Iterator; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.InstanceSpecification; @@ -37,7 +39,11 @@ public class InstanceSpecificationUtil { // name if (maskValues.contains(ICustomAppearance.DISP_NAME)) { - buffer.append(NamedElementUtil.getName(instance)); + if(null != instance.getName()){ + buffer.append(UMLLabelInternationalization.getInstance().getLabel(instance)); + }else{ + buffer.append((NamedElementUtil.getDefaultNameWithIncrement(instance))); + } } // classifier diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/MultiplicityElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/MultiplicityElementUtil.java index ac868ece577..633d0ffae7d 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/MultiplicityElementUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/MultiplicityElementUtil.java @@ -9,6 +9,7 @@ * * Contributors: * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.tools.utils; @@ -215,7 +216,7 @@ public class MultiplicityElementUtil { * @return The string representing the value specification */ private static String getStringSpecificationValue(final ValueSpecification valueSpecification, final boolean isEdition) { - String boundStr = ValueSpecificationUtil.getSpecificationValue(valueSpecification); + String boundStr = ValueSpecificationUtil.getSpecificationValue(valueSpecification, true); if (isEdition && valueSpecification instanceof LiteralString) { final StringBuffer buffer = new StringBuffer(); buffer.append(QUOTE); diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java index c0492cec2ce..2927a23d0d3 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java @@ -1,236 +1,238 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.papyrus.infra.tools.util.StringHelper;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.Operation</code><BR>
- */
-public class OperationUtil {
-
- /**
- * return the custom label of the operation, given UML2 specification and a custom style.
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the operation
- */
- public static String getCustomLabel(Operation operation, Collection<String> maskValues) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(" "); // adds " " first for correct display considerations
-
- // visibility
- if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(operation));
- }
-
- // name
- if (maskValues.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(operation.getName());
- }
-
- //
- // parameters : '(' parameter-list ')'
- buffer.append("(");
- buffer.append(OperationUtil.getParametersAsString(operation, maskValues));
- buffer.append(")");
-
- // return type
- if (maskValues.contains(ICustomAppearance.DISP_RT_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE)) {
- buffer.append(OperationUtil.getReturnTypeAsString(operation, maskValues));
- }
-
- // modifiers
- if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) {
- String modifiers = OperationUtil.getModifiersAsString(operation);
- if (!modifiers.equals("")) {
- buffer.append("{");
- buffer.append(modifiers);
- buffer.append("}");
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns return parameter label as a string, string parametrized with a style mask.
- *
- * @param style
- * the mask that indicates which element to display
- * @return a string containing the return parameter type
- */
- private static String getReturnTypeAsString(Operation operation, Collection<String> maskValues) {
- boolean displayType = maskValues.contains(ICustomAppearance.DISP_RT_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE);
- boolean displayMultiplicity = maskValues.contains(ICustomAppearance.DISP_RT_MULTIPLICITY) || maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY);
- StringBuffer label = new StringBuffer("");
-
- // Retrieve the return parameter (assume to be unique if defined)
- Parameter returnParameter = OperationUtil.getReturnParameter(operation);
- // Create the string for the return type
- if (returnParameter == null) {
- // no-operation: label = ""
-
- } else if (!displayType && !displayMultiplicity) {
- // no-operation: label = ""
-
- } else {
- label.append(": ");
- if (displayType) {
- label.append(TypedElementUtil.getTypeAsString(returnParameter));
- }
-
- if (displayMultiplicity) {
- label.append(MultiplicityElementUtil.getMultiplicityAsString(returnParameter));
- }
- }
- return label.toString();
- }
-
- /**
- * Returns operation parameters as a string, the label is customized using a bit mask
- *
- * @return a string containing all parameters separated by commas
- */
- private static String getParametersAsString(Operation operation, Collection<String> maskValues) {
- StringBuffer paramString = new StringBuffer();
- Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator();
- boolean firstParameter = true;
- while (paramIterator.hasNext()) {
- Parameter parameter = paramIterator.next();
- // Do not include return parameters
- if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
-
- // get the label for this parameter
- String parameterString = ParameterUtil.getCustomLabel(parameter, extractParameterMaskValues(maskValues));
- if (!parameterString.trim().equals("")) {
- if (!firstParameter) {
- paramString.append(", ");
- }
- paramString.append(parameterString);
- firstParameter = false;
- }
- }
- }
- return paramString.toString();
- }
-
- private static Collection<String> extractParameterMaskValues(Collection<String> operationMaskValues) {
- Set<String> result = new HashSet<String>();
-
- for (String maskValue : operationMaskValues) {
- if (maskValue.startsWith(ICustomAppearance.PARAMETERS_PREFIX)) {
- String newValue = StringHelper.firstToLower(maskValue.replace(ICustomAppearance.PARAMETERS_PREFIX, ""));
- result.add(newValue);
- }
- }
-
- return result;
- }
-
- /**
- * Returns operation modifiers as string, separated with comma.
- *
- * @return a string containing the modifiers
- */
- private static String getModifiersAsString(Operation operation) {
- StringBuffer buffer = new StringBuffer();
- boolean needsComma = false;
-
- // Return parameter modifiers
- Parameter returnParameter = OperationUtil.getReturnParameter(operation);
- if (returnParameter != null) {
- // non unique parameter
- if (!returnParameter.isUnique()) {
- buffer.append("nonunique");
- needsComma = true;
- }
-
- // return parameter has ordered values
- if (returnParameter.isOrdered()) {
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("ordered");
- needsComma = true;
- }
- }
-
- // is the operation a query ?
- if (operation.isQuery()) {
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("query");
- needsComma = true;
- }
-
- // is the operation redefining another operation ?
- Iterator<Operation> it = operation.getRedefinedOperations().iterator();
- while (it.hasNext()) {
- Operation currentOperation = it.next();
- if (needsComma) {
- buffer.append(", ");
- }
- buffer.append("redefines ");
- buffer.append(currentOperation.getName());
- needsComma = true;
- }
-
- // has the operation a constraint ?
- Iterator<Constraint> it2 = operation.getOwnedRules().iterator();
- while (it2.hasNext()) {
- Constraint constraint = it2.next();
- if (needsComma) {
- buffer.append(", ");
- }
- if (constraint.getSpecification() != null) {
- buffer.append(constraint.getSpecification().stringValue());
- }
- needsComma = true;
- }
-
- return buffer.toString();
- }
-
- /**
- * Gives the return parameter for this operation, or <code>null</code> if none exists.
- *
- * @return the return parameter of the operation or <code>null</code>
- */
- private static Parameter getReturnParameter(Operation operation) {
- // Retrieve the return parameter (assume to be unique if defined)
- Parameter returnParameter = null;
-
- Iterator<Parameter> it = operation.getOwnedParameters().iterator();
- while ((returnParameter == null) && (it.hasNext())) {
- Parameter parameter = it.next();
- if (parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
- returnParameter = parameter;
- }
- }
- return returnParameter;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.papyrus.infra.tools.util.StringHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Parameter; +import org.eclipse.uml2.uml.ParameterDirectionKind; + +/** + * Utility class for <code>org.eclipse.uml2.uml.Operation</code><BR> + */ +public class OperationUtil { + + /** + * return the custom label of the operation, given UML2 specification and a custom style. + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the operation + */ + public static String getCustomLabel(Operation operation, Collection<String> maskValues) { + StringBuffer buffer = new StringBuffer(); + buffer.append(" "); // adds " " first for correct display considerations + + // visibility + if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(operation)); + } + + // name + if (maskValues.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(operation)); + } + + // + // parameters : '(' parameter-list ')' + buffer.append("("); + buffer.append(OperationUtil.getParametersAsString(operation, maskValues)); + buffer.append(")"); + + // return type + if (maskValues.contains(ICustomAppearance.DISP_RT_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE)) { + buffer.append(OperationUtil.getReturnTypeAsString(operation, maskValues)); + } + + // modifiers + if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { + String modifiers = OperationUtil.getModifiersAsString(operation); + if (!modifiers.equals("")) { + buffer.append("{"); + buffer.append(modifiers); + buffer.append("}"); + } + } + return buffer.toString(); + } + + /** + * Returns return parameter label as a string, string parametrized with a style mask. + * + * @param style + * the mask that indicates which element to display + * @return a string containing the return parameter type + */ + private static String getReturnTypeAsString(Operation operation, Collection<String> maskValues) { + boolean displayType = maskValues.contains(ICustomAppearance.DISP_RT_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE); + boolean displayMultiplicity = maskValues.contains(ICustomAppearance.DISP_RT_MULTIPLICITY) || maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY); + StringBuffer label = new StringBuffer(""); + + // Retrieve the return parameter (assume to be unique if defined) + Parameter returnParameter = OperationUtil.getReturnParameter(operation); + // Create the string for the return type + if (returnParameter == null) { + // no-operation: label = "" + + } else if (!displayType && !displayMultiplicity) { + // no-operation: label = "" + + } else { + label.append(": "); + if (displayType) { + label.append(TypedElementUtil.getTypeAsString(returnParameter)); + } + + if (displayMultiplicity) { + label.append(MultiplicityElementUtil.getMultiplicityAsString(returnParameter)); + } + } + return label.toString(); + } + + /** + * Returns operation parameters as a string, the label is customized using a bit mask + * + * @return a string containing all parameters separated by commas + */ + private static String getParametersAsString(Operation operation, Collection<String> maskValues) { + StringBuffer paramString = new StringBuffer(); + Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator(); + boolean firstParameter = true; + while (paramIterator.hasNext()) { + Parameter parameter = paramIterator.next(); + // Do not include return parameters + if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) { + + // get the label for this parameter + String parameterString = ParameterUtil.getCustomLabel(parameter, extractParameterMaskValues(maskValues)); + if (!parameterString.trim().equals("")) { + if (!firstParameter) { + paramString.append(", "); + } + paramString.append(parameterString); + firstParameter = false; + } + } + } + return paramString.toString(); + } + + private static Collection<String> extractParameterMaskValues(Collection<String> operationMaskValues) { + Set<String> result = new HashSet<String>(); + + for (String maskValue : operationMaskValues) { + if (maskValue.startsWith(ICustomAppearance.PARAMETERS_PREFIX)) { + String newValue = StringHelper.firstToLower(maskValue.replace(ICustomAppearance.PARAMETERS_PREFIX, "")); + result.add(newValue); + } + } + + return result; + } + + /** + * Returns operation modifiers as string, separated with comma. + * + * @return a string containing the modifiers + */ + private static String getModifiersAsString(Operation operation) { + StringBuffer buffer = new StringBuffer(); + boolean needsComma = false; + + // Return parameter modifiers + Parameter returnParameter = OperationUtil.getReturnParameter(operation); + if (returnParameter != null) { + // non unique parameter + if (!returnParameter.isUnique()) { + buffer.append("nonunique"); + needsComma = true; + } + + // return parameter has ordered values + if (returnParameter.isOrdered()) { + if (needsComma) { + buffer.append(", "); + } + buffer.append("ordered"); + needsComma = true; + } + } + + // is the operation a query ? + if (operation.isQuery()) { + if (needsComma) { + buffer.append(", "); + } + buffer.append("query"); + needsComma = true; + } + + // is the operation redefining another operation ? + Iterator<Operation> it = operation.getRedefinedOperations().iterator(); + while (it.hasNext()) { + Operation currentOperation = it.next(); + if (needsComma) { + buffer.append(", "); + } + buffer.append("redefines "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(currentOperation)); + needsComma = true; + } + + // has the operation a constraint ? + Iterator<Constraint> it2 = operation.getOwnedRules().iterator(); + while (it2.hasNext()) { + Constraint constraint = it2.next(); + if (needsComma) { + buffer.append(", "); + } + if (constraint.getSpecification() != null) { + buffer.append(constraint.getSpecification().stringValue()); + } + needsComma = true; + } + + return buffer.toString(); + } + + /** + * Gives the return parameter for this operation, or <code>null</code> if none exists. + * + * @return the return parameter of the operation or <code>null</code> + */ + private static Parameter getReturnParameter(Operation operation) { + // Retrieve the return parameter (assume to be unique if defined) + Parameter returnParameter = null; + + Iterator<Parameter> it = operation.getOwnedParameters().iterator(); + while ((returnParameter == null) && (it.hasNext())) { + Parameter parameter = it.next(); + if (parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) { + returnParameter = parameter; + } + } + return returnParameter; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java index c779540538b..e81c1fdc86d 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java @@ -11,6 +11,7 @@ * Remi SCHNEKENBURGER (CEA LIST) Remi.schnekenburger@cea.fr - Initial API and implementation * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr * Christian W. Damus (CEA) - bug 402525 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.tools.utils; @@ -39,6 +40,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Collaboration; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; @@ -606,8 +608,8 @@ public class PackageUtil { * {@inheritDoc} */ public int compare(Type o1, Type o2) { - final String o1Name = ((o1.getName() != null) ? o1.getName() : ""); //$NON-NLS-1$ - final String o2Name = ((o2.getName() != null) ? o2.getName() : ""); //$NON-NLS-1$ + final String o1Name = ((o1.getName() != null) ? UMLLabelInternationalization.getInstance().getLabel(o1) : ""); //$NON-NLS-1$ + final String o2Name = ((o2.getName() != null) ? UMLLabelInternationalization.getInstance().getLabel(o2) : ""); //$NON-NLS-1$ return o1Name.compareTo(o2Name); } } diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java index 7717e5bd448..7b7fcf6f954 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java @@ -1,214 +1,216 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Collection;
-
-import org.eclipse.uml2.uml.Parameter;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.Parameter</code><BR>
- */
-public class ParameterUtil {
-
- /**
- * Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline
- * string if <code>multiline</code> is <code>false</code>.
- *
- * @param multiLine
- * boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to <code>false</code>.
- *
- * @return a string giving all modifiers for the property
- */
- public static String getModifiersAsString(Parameter parameter, boolean multiLine) {
- StringBuffer buffer = new StringBuffer();
- boolean needsComma = false;
- String NL = (multiLine) ? "\n" : " ";
-
- // Return parameter modifiers
- if (parameter.isOrdered()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "ordered");
- ;
- }
- if (parameter.isUnique()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "unique");
- }
- if (parameter.isException()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "exception");
- }
- if (parameter.isStream()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "stream");
- }
-
- if (!buffer.toString().equals("")) {
- buffer.insert(0, "{");
- buffer.append("}");
- }
-
- return buffer.toString();
- }
-
- /**
- * Update the modifiers string
- *
- * @param buffer
- * the existing bufferString to append
- * @param needsComma
- * if it needs coma
- * @param NL
- * if it is multiline
- * @param message
- * the message top
- * @return true because the modifier string is no more empty
- */
- private static boolean updateModifiersString(StringBuffer buffer, boolean needsComma, String NL, String message) {
- if (needsComma) {
- buffer.append(",");
- buffer.append(NL);
- }
- buffer.append(message);
- return true;
- }
-
- /**
- * return the full label of the Parameter.
- *
- * @return the string corresponding to the label of the parameter
- */
- public static String getLabel(Parameter parameter) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
-
- // direction
- buffer.append(" ");
- buffer.append(parameter.getDirection().getLiteral());
-
- // name
- buffer.append(" ");
- if (parameter.getName() != null) {
- buffer.append(parameter.getName());
- }
-
- // type
- if (parameter.getType() != null) {
- buffer.append(": " + parameter.getType().getName());
- } else {
- buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
-
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
- if (!multiplicity.trim().equals("[1]")) {
- buffer.append(multiplicity);
- }
-
- // default value
- if (parameter.getDefault() != null) {
- buffer.append(" = ");
- buffer.append(parameter.getDefault());
- }
-
- // property modifiers
- buffer.append(ParameterUtil.getModifiersAsString(parameter, false));
-
- return buffer.toString();
- }
-
- /**
- * return the custom label of the property, given UML2 specification and a custom style.
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the property
- */
- public static String getCustomLabel(Parameter parameter, Collection<String> maskValues) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
- }
-
- // direction property
- if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION) || maskValues.contains(ICustomAppearance.DISP_DIRECTION)) {
- buffer.append(" ");
- buffer.append(parameter.getDirection().getLiteral());
- }
-
- // name
- if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_NAME) || maskValues.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(parameter.getName());
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE)) {
- // type
- if (parameter.getType() != null) {
- buffer.append(": " + parameter.getType().getName());
- } else {
- buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY) || maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) {
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
- buffer.append(multiplicity);
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) {
- // default value
- if (parameter.getDefault() != null) {
- buffer.append(" = ");
- buffer.append(parameter.getDefault());
- }
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) {
- boolean multiLine = (maskValues.contains(ICustomAppearance.DISP_MULTI_LINE));
- // property modifiers
- String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine);
- if (!modifiers.equals("")) {
- if (multiLine) {
- buffer.append("\n");
- }
- buffer.append(modifiers);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns the default value as a String
- *
- * @param equalSign
- * boolean set to <code>true</code> if the label must have the <code>=</code> sign
- * before the default value
- * @return the default value as a String
- */
- private static String getDefaultAsString(Parameter parameter, boolean equalSign) {
- String defaultString = "";
- // default value
- if ((parameter.getDefault() != null) && !parameter.getDefault().equals("")) {
- if (equalSign) {
- defaultString += "= ";
- }
- defaultString += parameter.getDefault();
- }
- return "";
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Parameter; + +/** + * Utility class for <code>org.eclipse.uml2.uml.Parameter</code><BR> + */ +public class ParameterUtil { + + /** + * Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline + * string if <code>multiline</code> is <code>false</code>. + * + * @param multiLine + * boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to <code>false</code>. + * + * @return a string giving all modifiers for the property + */ + public static String getModifiersAsString(Parameter parameter, boolean multiLine) { + StringBuffer buffer = new StringBuffer(); + boolean needsComma = false; + String NL = (multiLine) ? "\n" : " "; + + // Return parameter modifiers + if (parameter.isOrdered()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "ordered"); + ; + } + if (parameter.isUnique()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "unique"); + } + if (parameter.isException()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "exception"); + } + if (parameter.isStream()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "stream"); + } + + if (!buffer.toString().equals("")) { + buffer.insert(0, "{"); + buffer.append("}"); + } + + return buffer.toString(); + } + + /** + * Update the modifiers string + * + * @param buffer + * the existing bufferString to append + * @param needsComma + * if it needs coma + * @param NL + * if it is multiline + * @param message + * the message top + * @return true because the modifier string is no more empty + */ + private static boolean updateModifiersString(StringBuffer buffer, boolean needsComma, String NL, String message) { + if (needsComma) { + buffer.append(","); + buffer.append(NL); + } + buffer.append(message); + return true; + } + + /** + * return the full label of the Parameter. + * + * @return the string corresponding to the label of the parameter + */ + public static String getLabel(Parameter parameter) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + buffer.append(NamedElementUtil.getVisibilityAsSign(parameter)); + + // direction + buffer.append(" "); + buffer.append(parameter.getDirection().getLiteral()); + + // name + buffer.append(" "); + if (parameter.getName() != null) { + buffer.append(UMLLabelInternationalization.getInstance().getLabel(parameter)); + } + + // type + if (parameter.getType() != null) { + buffer.append(": " + UMLLabelInternationalization.getInstance().getLabel(parameter.getType())); + } else { + buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); + } + + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter); + if (!multiplicity.trim().equals("[1]")) { + buffer.append(multiplicity); + } + + // default value + if (parameter.getDefault() != null) { + buffer.append(" = "); + buffer.append(parameter.getDefault()); + } + + // property modifiers + buffer.append(ParameterUtil.getModifiersAsString(parameter, false)); + + return buffer.toString(); + } + + /** + * return the custom label of the property, given UML2 specification and a custom style. + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the property + */ + public static String getCustomLabel(Parameter parameter, Collection<String> maskValues) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(parameter)); + } + + // direction property + if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION) || maskValues.contains(ICustomAppearance.DISP_DIRECTION)) { + buffer.append(" "); + buffer.append(parameter.getDirection().getLiteral()); + } + + // name + if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_NAME) || maskValues.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(parameter)); + } + + if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_TYPE) || maskValues.contains(ICustomAppearance.DISP_TYPE)) { + // type + if (parameter.getType() != null) { + buffer.append(": " + UMLLabelInternationalization.getInstance().getLabel(parameter.getType())); + } else { + buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); + } + } + + if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY) || maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) { + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter); + buffer.append(multiplicity); + } + + if (maskValues.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) { + // default value + if (parameter.getDefault() != null) { + buffer.append(" = "); + buffer.append(parameter.getDefault()); + } + } + + if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { + boolean multiLine = (maskValues.contains(ICustomAppearance.DISP_MULTI_LINE)); + // property modifiers + String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine); + if (!modifiers.equals("")) { + if (multiLine) { + buffer.append("\n"); + } + buffer.append(modifiers); + } + } + return buffer.toString(); + } + + /** + * Returns the default value as a String + * + * @param equalSign + * boolean set to <code>true</code> if the label must have the <code>=</code> sign + * before the default value + * @return the default value as a String + */ + private static String getDefaultAsString(Parameter parameter, boolean equalSign) { + String defaultString = ""; + // default value + if ((parameter.getDefault() != null) && !parameter.getDefault().equals("")) { + if (equalSign) { + defaultString += "= "; + } + defaultString += parameter.getDefault(); + } + return ""; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java index 6d30ba4b855..7e8b21d2286 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java @@ -1,103 +1,105 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Collection;
-
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-
-
-public class PortUtil extends PropertyUtil {
-
- /**
- * return the custom label of the property, given UML2 specification and a custom style.
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the property
- */
- public static String getCustomLabel(Property property, Collection<String> maskValues) {
- StringBuffer buffer = new StringBuffer();
- // visibility
-
- buffer.append(" ");
- if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(property));
- }
-
- // derived property
- if (maskValues.contains(ICustomAppearance.DISP_DERIVE)) {
- if (property.isDerived()) {
- buffer.append("/");
- }
- }
- // name
- if (maskValues.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(property.getName());
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_TYPE)) {
- if (maskValues.contains(ICustomAppearance.DISP_CONJUGATED)) {
- if (((Port) property).isConjugated()) {
- buffer.append(": ~");
- } else {
- buffer.append(": ");
- }
- } else {
- buffer.append(": ");
- }
- // type
- if (property.getType() != null) {
- buffer.append(property.getType().getName());
- } else {
- buffer.append(TypeUtil.UNDEFINED_TYPE_NAME);
- }
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) {
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
- buffer.append(multiplicity);
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) {
- // default value
- if (property.getDefaultValue() != null) {
- buffer.append(" = ");
- buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue()));
- }
- }
-
- if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) {
- boolean multiLine = maskValues.contains(ICustomAppearance.DISP_MULTI_LINE);
- // property modifiers
- String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
- if (!modifiers.equals("")) {
- if (multiLine) {
- buffer.append("\n");
- }
-
- if (!buffer.toString().endsWith(" ")) {
- buffer.append(" ");
- }
-
- buffer.append(modifiers);
- }
- }
- return buffer.toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; + + +public class PortUtil extends PropertyUtil { + + /** + * return the custom label of the property, given UML2 specification and a custom style. + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the property + */ + public static String getCustomLabel(Property property, Collection<String> maskValues) { + StringBuffer buffer = new StringBuffer(); + // visibility + + buffer.append(" "); + if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(property)); + } + + // derived property + if (maskValues.contains(ICustomAppearance.DISP_DERIVE)) { + if (property.isDerived()) { + buffer.append("/"); + } + } + // name + if (maskValues.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(property)); + } + + if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { + if (maskValues.contains(ICustomAppearance.DISP_CONJUGATED)) { + if (((Port) property).isConjugated()) { + buffer.append(": ~"); + } else { + buffer.append(": "); + } + } else { + buffer.append(": "); + } + // type + if (property.getType() != null) { + buffer.append(UMLLabelInternationalization.getInstance().getLabel(property.getType())); + } else { + buffer.append(TypeUtil.UNDEFINED_TYPE_NAME); + } + } + + if (maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) { + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property); + buffer.append(multiplicity); + } + + if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) { + // default value + if (property.getDefaultValue() != null) { + buffer.append(" = "); + buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue(), true)); + } + } + + if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { + boolean multiLine = maskValues.contains(ICustomAppearance.DISP_MULTI_LINE); + // property modifiers + String modifiers = PropertyUtil.getModifiersAsString(property, multiLine); + if (!modifiers.equals("")) { + if (multiLine) { + buffer.append("\n"); + } + + if (!buffer.toString().endsWith(" ")) { + buffer.append(" "); + } + + buffer.append(modifiers); + } + } + return buffer.toString(); + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java index 23458631060..01779b93138 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java @@ -1,360 +1,362 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.Property</code><BR>
- */
-public class PropertyUtil {
-
- /**
- * Get all properties that can be subset by this {@link Property} checks the type and the
- * multiplicity.
- *
- * @param property
- * property for which the list of subsettable properties are made
- * @param noCheck
- * set this parameter to <code>true</code> if multiplicity and type check should be
- * made for the computation
- * @return all properties that can be subset
- */
- public static List<Property> getSubsettablesProperties(Property property, boolean noCheck) {
- List<Property> list = new ArrayList<Property>();
-
- // subset properties:
- Iterator<NamedElement> it = property.getClass_().getMembers().iterator();
- while (it.hasNext()) {
-
- NamedElement element = it.next();
- if (element instanceof Property) {
- boolean isValid = true;
- Property subsettableProperty = (Property) element;
-
- // check it is not itself....
- if (subsettableProperty.equals(property)) {
- isValid = false;
- }
-
- // check types conformity
- if (!noCheck) {
- if (property.getType() != null && subsettableProperty.getType() != null) {
- if (!property.getType().conformsTo(subsettableProperty.getType())) {
- isValid = false;
- }
- } else {
- isValid = false;
- }
-
- // check multiplicity (only upper bound has an OCL rule)
- if ((subsettableProperty.getUpper() != -1) && (property.getUpper() > subsettableProperty.getUpper())) {
- isValid = false;
- }
- }
-
- if (isValid) {
- list.add(subsettableProperty);
- }
- }
- }
- return list;
- }
-
- /**
- * Find a subsetted property given its name and a context to find it.
- *
- * @param name
- * the name of the property
- * @return the property found or <code>null</code> if the element was not found.
- */
- // @unused
- public static Property findSusbsettedPropertyByName(String propertyName, Property property, boolean noCheck) {
- Iterator<Property> it = PropertyUtil.getSubsettablesProperties(property, true).iterator();
- while (it.hasNext()) {
- Property tmpProperty = it.next();
- String tmpPropertyName = tmpProperty.getName();
- if (tmpPropertyName != null && propertyName.equals(tmpPropertyName.trim())) {
- return tmpProperty;
- }
- }
- return null;
- }
-
- /**
- * Get all properties that can be redefined by this {@link Property}.
- *
- * @return all properties that can be redefined
- */
- public static List<Property> getRedefinableProperties(Property property) {
- List<Property> list = new ArrayList<Property>();
-
- // redefine-able properties:
- Iterator<NamedElement> it = property.getClass_().getInheritedMembers().iterator();
- while (it.hasNext()) {
- NamedElement element = it.next();
- if (element instanceof Property) {
- list.add((Property) element);
- }
- }
-
- // adds also already redefined members. In fact, when properties are
- // redefined, they
- // disappear from the inherited members list
- Iterator<Property> it2 = property.getRedefinedProperties().iterator();
- while (it2.hasNext()) {
- Property element = it2.next();
- list.add(element);
- }
- return list;
- }
-
- /**
- * Find a redefined property given its name and a context to find it.
- *
- * @param name
- * the name of the property
- * @return the property found or <code>null</code> if the element was not found.
- */
- public static Property findRedefinedPropertyByName(String propertyName, Property property) {
- Iterator<Property> it = PropertyUtil.getRedefinableProperties(property).iterator();
- while (it.hasNext()) {
- Property tmpProperty = it.next();
- String tmpPropertyName = tmpProperty.getName();
- if (tmpPropertyName != null && propertyName.equals(tmpPropertyName.trim())) {
- return tmpProperty;
- }
- }
- return null;
- }
-
- /**
- * Get the displayed string for the derived attribute of the property.
- *
- * @param property
- * the property
- * @return If the property is derived, return "/". Otherwise return an empty String
- */
- public static String getDerived(Property property) {
- return property.isDerived() ? "/" : "";
- }
-
- /**
- * return the full label of the property, given UML2 specification.
- *
- * @return the string corresponding to the label of the property
- */
- public static String getLabel(Property property) {
- StringBuffer buffer = new StringBuffer();
- // visibility
- buffer.append(" ");
- buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property)));
-
- // derived property
- buffer.append(getNonNullString(getDerived(property)));
-
- // name
- buffer.append(" ");
- buffer.append(getNonNullString(getName(property)));
-
- // type
- if (property.getType() != null) {
- buffer.append(" : " + getNonNullString(property.getType().getName()));
- } else {
- buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
-
- // multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
- if (!multiplicity.trim().equals("[1]")) {
- buffer.append(getNonNullString(multiplicity));
- }
-
- // default value
- if (property.getDefaultValue() != null) {
- buffer.append(" = ");
- buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue())));
- }
-
- // property modifiers
- buffer.append(getNonNullString(PropertyUtil.getModifiersAsString(property, false)));
-
- return buffer.toString();
- }
-
- public static String getName(Property property) {
- if (property.getName() != null) {
- return property.getName();
- } else {
- return (NamedElementUtil.getDefaultNameWithIncrement(property));
- }
- }
-
- private static String getNonNullString(String source) {
- return source == null ? "" : source;
- }
-
- /**
- * return the custom label of the property, given UML2 specification and a custom style.
- *
- * @param style
- * the collection of label fragments to display
- *
- * @return the string corresponding to the label of the property
- */
- public static String getCustomLabel(Property property, Collection<String> style) {
- StringBuffer buffer = new StringBuffer();
- // visibility
-
- buffer.append(" ");
- if (style.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property)));
- }
-
- // derived property
- if (style.contains(ICustomAppearance.DISP_DERIVE)) {
- if (property.isDerived()) {
- buffer.append("/");
- }
- }
- // name
- if (style.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(getNonNullString(property.getName()));
- }
-
- if (style.contains(ICustomAppearance.DISP_TYPE)) {
- // type
- if (property.getType() != null) {
- buffer.append(": " + getNonNullString(property.getType().getName()));
- } else {
- buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
- }
- }
-
- if (style.contains(ICustomAppearance.DISP_MULTIPLICITY)) {
- // multiplicity -> do not display [1]
- String multiplicity = getNonNullString(MultiplicityElementUtil.getMultiplicityAsString(property));
- buffer.append(multiplicity);
- } else if (style.contains(ICustomAppearance.DISP_MULTIPLICITY_NO_BRACKETS)) {
- String multiplicity = getNonNullString(MultiplicityElementUtil.formatMultiplicityNoBrackets(property));
- buffer.append(multiplicity);
- }
-
- if (style.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) {
- // default value
- if (property.getDefaultValue() != null) {
- buffer.append(" = ");
- buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue())));
- }
- }
-
- if (style.contains(ICustomAppearance.DISP_MODIFIERS)) {
- boolean multiLine = style.contains(ICustomAppearance.DISP_MULTI_LINE);
- // property modifiers
- String modifiers = getNonNullString(PropertyUtil.getModifiersAsString(property, multiLine));
- if (!modifiers.equals("")) {
- if (multiLine) {
- buffer.append("\n");
- }
-
- if (!buffer.toString().endsWith(" ")) {
- buffer.append(" ");
- }
-
- buffer.append(modifiers);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline
- * string if <code>multiline</code> is <code>false</code>.
- *
- * @param multiLine
- * boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to <code>false</code>.
- *
- * @return a string giving all modifiers for the property
- */
- public static String getModifiersAsString(Property property, boolean multiLine) {
- StringBuffer buffer = new StringBuffer();
- boolean needsComma = false;
- String NL = (multiLine) ? "\n" : " ";
-
- // Return property modifiers
- if (property.isReadOnly()) {
- buffer.append("readOnly");
- needsComma = true;
- }
- if (property.isDerivedUnion()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "union");
- }
- if (property.isOrdered()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "ordered");
- ;
- }
- if (property.isUnique()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "unique");
- }
-
- // is the property redefining another property ?
- for (Property current : property.getRedefinedProperties()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "redefines ");
- buffer.append(current.getName());
- }
-
- // is the property subsetting another property ?
- for (Property current : property.getSubsettedProperties()) {
- needsComma = updateModifiersString(buffer, needsComma, NL, "subsets ");
- buffer.append(current.getName());
- }
-
- if (!buffer.toString().equals("")) {
- buffer.insert(0, "{");
- buffer.append("}");
- }
-
- return buffer.toString();
- }
-
- /**
- * Update the modifiers string
- *
- * @param buffer
- * the existing bufferString to append
- * @param needsComma
- * if it needs coma
- * @param NL
- * if it is multiline
- * @param message
- * the message top
- * @return true because the modifier string is no more empty
- */
- private static boolean updateModifiersString(StringBuffer buffer, boolean needsComma, String NL, String message) {
- if (needsComma) {
- buffer.append(",");
- buffer.append(NL);
- }
- buffer.append(message);
- return true;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; + +/** + * Utility class for <code>org.eclipse.uml2.uml.Property</code><BR> + */ +public class PropertyUtil { + + /** + * Get all properties that can be subset by this {@link Property} checks the type and the + * multiplicity. + * + * @param property + * property for which the list of subsettable properties are made + * @param noCheck + * set this parameter to <code>true</code> if multiplicity and type check should be + * made for the computation + * @return all properties that can be subset + */ + public static List<Property> getSubsettablesProperties(Property property, boolean noCheck) { + List<Property> list = new ArrayList<Property>(); + + // subset properties: + Iterator<NamedElement> it = property.getClass_().getMembers().iterator(); + while (it.hasNext()) { + + NamedElement element = it.next(); + if (element instanceof Property) { + boolean isValid = true; + Property subsettableProperty = (Property) element; + + // check it is not itself.... + if (subsettableProperty.equals(property)) { + isValid = false; + } + + // check types conformity + if (!noCheck) { + if (property.getType() != null && subsettableProperty.getType() != null) { + if (!property.getType().conformsTo(subsettableProperty.getType())) { + isValid = false; + } + } else { + isValid = false; + } + + // check multiplicity (only upper bound has an OCL rule) + if ((subsettableProperty.getUpper() != -1) && (property.getUpper() > subsettableProperty.getUpper())) { + isValid = false; + } + } + + if (isValid) { + list.add(subsettableProperty); + } + } + } + return list; + } + + /** + * Find a subsetted property given its name and a context to find it. + * + * @param name + * the name of the property + * @return the property found or <code>null</code> if the element was not found. + */ + // @unused + public static Property findSusbsettedPropertyByName(String propertyName, Property property, boolean noCheck) { + Iterator<Property> it = PropertyUtil.getSubsettablesProperties(property, true).iterator(); + while (it.hasNext()) { + Property tmpProperty = it.next(); + String tmpPropertyName = tmpProperty.getName(); + if (tmpPropertyName != null && propertyName.equals(tmpPropertyName.trim())) { + return tmpProperty; + } + } + return null; + } + + /** + * Get all properties that can be redefined by this {@link Property}. + * + * @return all properties that can be redefined + */ + public static List<Property> getRedefinableProperties(Property property) { + List<Property> list = new ArrayList<Property>(); + + // redefine-able properties: + Iterator<NamedElement> it = property.getClass_().getInheritedMembers().iterator(); + while (it.hasNext()) { + NamedElement element = it.next(); + if (element instanceof Property) { + list.add((Property) element); + } + } + + // adds also already redefined members. In fact, when properties are + // redefined, they + // disappear from the inherited members list + Iterator<Property> it2 = property.getRedefinedProperties().iterator(); + while (it2.hasNext()) { + Property element = it2.next(); + list.add(element); + } + return list; + } + + /** + * Find a redefined property given its name and a context to find it. + * + * @param name + * the name of the property + * @return the property found or <code>null</code> if the element was not found. + */ + public static Property findRedefinedPropertyByName(String propertyName, Property property) { + Iterator<Property> it = PropertyUtil.getRedefinableProperties(property).iterator(); + while (it.hasNext()) { + Property tmpProperty = it.next(); + String tmpPropertyName = tmpProperty.getName(); + if (tmpPropertyName != null && propertyName.equals(tmpPropertyName.trim())) { + return tmpProperty; + } + } + return null; + } + + /** + * Get the displayed string for the derived attribute of the property. + * + * @param property + * the property + * @return If the property is derived, return "/". Otherwise return an empty String + */ + public static String getDerived(Property property) { + return property.isDerived() ? "/" : ""; + } + + /** + * return the full label of the property, given UML2 specification. + * + * @return the string corresponding to the label of the property + */ + public static String getLabel(Property property) { + StringBuffer buffer = new StringBuffer(); + // visibility + buffer.append(" "); + buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property))); + + // derived property + buffer.append(getNonNullString(getDerived(property))); + + // name + buffer.append(" "); + buffer.append(getNonNullString(getName(property))); + + // type + if (property.getType() != null) { + buffer.append(" : " + getNonNullString(UMLLabelInternationalization.getInstance().getLabel(property.getType()))); + } else { + buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME); + } + + // multiplicity -> do not display [1] + String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property); + if (!multiplicity.trim().equals("[1]")) { + buffer.append(getNonNullString(multiplicity)); + } + + // default value + if (property.getDefaultValue() != null) { + buffer.append(" = "); + buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue()))); + } + + // property modifiers + buffer.append(getNonNullString(PropertyUtil.getModifiersAsString(property, false))); + + return buffer.toString(); + } + + public static String getName(Property property) { + if (property.getName() != null) { + return UMLLabelInternationalization.getInstance().getLabel(property); + } else { + return (NamedElementUtil.getDefaultNameWithIncrement(property)); + } + } + + private static String getNonNullString(String source) { + return source == null ? "" : source; + } + + /** + * return the custom label of the property, given UML2 specification and a custom style. + * + * @param style + * the collection of label fragments to display + * + * @return the string corresponding to the label of the property + */ + public static String getCustomLabel(Property property, Collection<String> style) { + StringBuffer buffer = new StringBuffer(); + // visibility + + buffer.append(" "); + if (style.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property))); + } + + // derived property + if (style.contains(ICustomAppearance.DISP_DERIVE)) { + if (property.isDerived()) { + buffer.append("/"); + } + } + // name + if (style.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(getNonNullString(UMLLabelInternationalization.getInstance().getLabel(property))); + } + + if (style.contains(ICustomAppearance.DISP_TYPE)) { + // type + if (property.getType() != null) { + buffer.append(": " + getNonNullString(UMLLabelInternationalization.getInstance().getLabel(property.getType()))); + } else { + buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME); + } + } + + if (style.contains(ICustomAppearance.DISP_MULTIPLICITY)) { + // multiplicity -> do not display [1] + String multiplicity = getNonNullString(MultiplicityElementUtil.getMultiplicityAsString(property)); + buffer.append(multiplicity); + } else if (style.contains(ICustomAppearance.DISP_MULTIPLICITY_NO_BRACKETS)) { + String multiplicity = getNonNullString(MultiplicityElementUtil.formatMultiplicityNoBrackets(property)); + buffer.append(multiplicity); + } + + if (style.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) { + // default value + if (property.getDefaultValue() != null) { + buffer.append(" = "); + buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue(), true))); + } + } + + if (style.contains(ICustomAppearance.DISP_MODIFIERS)) { + boolean multiLine = style.contains(ICustomAppearance.DISP_MULTI_LINE); + // property modifiers + String modifiers = getNonNullString(PropertyUtil.getModifiersAsString(property, multiLine)); + if (!modifiers.equals("")) { + if (multiLine) { + buffer.append("\n"); + } + + if (!buffer.toString().endsWith(" ")) { + buffer.append(" "); + } + + buffer.append(modifiers); + } + } + return buffer.toString(); + } + + /** + * Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline + * string if <code>multiline</code> is <code>false</code>. + * + * @param multiLine + * boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to <code>false</code>. + * + * @return a string giving all modifiers for the property + */ + public static String getModifiersAsString(Property property, boolean multiLine) { + StringBuffer buffer = new StringBuffer(); + boolean needsComma = false; + String NL = (multiLine) ? "\n" : " "; + + // Return property modifiers + if (property.isReadOnly()) { + buffer.append("readOnly"); + needsComma = true; + } + if (property.isDerivedUnion()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "union"); + } + if (property.isOrdered()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "ordered"); + ; + } + if (property.isUnique()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "unique"); + } + + // is the property redefining another property ? + for (Property current : property.getRedefinedProperties()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "redefines "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(current)); + } + + // is the property subsetting another property ? + for (Property current : property.getSubsettedProperties()) { + needsComma = updateModifiersString(buffer, needsComma, NL, "subsets "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(current)); + } + + if (!buffer.toString().equals("")) { + buffer.insert(0, "{"); + buffer.append("}"); + } + + return buffer.toString(); + } + + /** + * Update the modifiers string + * + * @param buffer + * the existing bufferString to append + * @param needsComma + * if it needs coma + * @param NL + * if it is multiline + * @param message + * the message top + * @return true because the modifier string is no more empty + */ + private static boolean updateModifiersString(StringBuffer buffer, boolean needsComma, String NL, String message) { + if (needsComma) { + buffer.append(","); + buffer.append(NL); + } + buffer.append(message); + return true; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java index 3b788ce2b5d..93569ca5f8f 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java @@ -1,79 +1,81 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Collection;
-
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Signal;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.Signal</code><BR>
- */
-public class SignalUtil {
-
- /**
- * return the custom label of the signal, given UML2 specification and a custom style.
- *
- * @param style
- * the integer representing the style of the label
- *
- * @return the string corresponding to the label of the signal
- */
- public static String getCustomLabel(Signal signal, Collection<String> maskValues) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(" "); // adds " " first for correct display considerations
-
- // visibility
- if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(signal));
- }
-
- // name
- if (maskValues.contains(ICustomAppearance.DISP_NAME)) {
- buffer.append(" ");
- buffer.append(signal.getName());
- }
-
- //
- // parameters : '(' parameter-list ')'
- buffer.append("(");
- buffer.append(getPropertiesAsString(signal, maskValues));
- buffer.append(")");
-
- return buffer.toString();
- }
-
- /**
- * Returns signal properties as a string, the label is customized using a bit mask
- *
- * @return a string containing all properties separated by commas
- */
- private static String getPropertiesAsString(Signal signal, Collection<String> maskValues) {
- StringBuffer propertiesString = new StringBuffer();
- boolean firstProperty = true;
- for (Property property : signal.getOwnedAttributes()) {
- // get the label for this property
- String propertyString = PropertyUtil.getCustomLabel(property, maskValues);
- if (!propertyString.trim().equals("")) {
- if (!firstProperty) {
- propertiesString.append(", ");
- }
- propertiesString.append(propertyString);
- firstProperty = false;
- }
- }
- return propertiesString.toString();
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Atos Origin - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Signal; + +/** + * Utility class for <code>org.eclipse.uml2.uml.Signal</code><BR> + */ +public class SignalUtil { + + /** + * return the custom label of the signal, given UML2 specification and a custom style. + * + * @param style + * the integer representing the style of the label + * + * @return the string corresponding to the label of the signal + */ + public static String getCustomLabel(Signal signal, Collection<String> maskValues) { + StringBuffer buffer = new StringBuffer(); + buffer.append(" "); // adds " " first for correct display considerations + + // visibility + if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { + buffer.append(NamedElementUtil.getVisibilityAsSign(signal)); + } + + // name + if (maskValues.contains(ICustomAppearance.DISP_NAME)) { + buffer.append(" "); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(signal)); + } + + // + // parameters : '(' parameter-list ')' + buffer.append("("); + buffer.append(getPropertiesAsString(signal, maskValues)); + buffer.append(")"); + + return buffer.toString(); + } + + /** + * Returns signal properties as a string, the label is customized using a bit mask + * + * @return a string containing all properties separated by commas + */ + private static String getPropertiesAsString(Signal signal, Collection<String> maskValues) { + StringBuffer propertiesString = new StringBuffer(); + boolean firstProperty = true; + for (Property property : signal.getOwnedAttributes()) { + // get the label for this property + String propertyString = PropertyUtil.getCustomLabel(property, maskValues); + if (!propertyString.trim().equals("")) { + if (!firstProperty) { + propertiesString.append(", "); + } + propertiesString.append(propertyString); + firstProperty = false; + } + } + return propertiesString.toString(); + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypeUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypeUtil.java index 86714ec6772..fae53a36979 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypeUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypeUtil.java @@ -1,71 +1,73 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.Iterator;
-
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.Type</code><BR>
- */
-public class TypeUtil {
-
- public final static String UNDEFINED_TYPE_NAME = "<Undefined>";
-
- /**
- * Get a string that displays the name of the type, and then its namespace.
- * <p>
- * For example: "String - UMLPrimitiveType"
- *
- * @return a string that displays information about the type
- */
- public static String getInfoString(Type type) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(type.getName());
- buffer.append(" - ");
- String tmp = "";
- Iterator<Namespace> it = type.allNamespaces().iterator();
- while (it.hasNext()) {
- Namespace namespace = it.next();
- if (it.hasNext()) {
- tmp = NamedElement.SEPARATOR + namespace.getName() + tmp;
- } else {
- tmp = namespace.getName() + tmp;
- }
- }
- buffer.append(tmp);
- return buffer.toString();
- }
-
- /**
- *
- *
- * @param type
- * to check
- *
- * @return true if type is metaclass, else false
- */
- @Deprecated
- // use {@link Class#isMetaclass()} Check if a type is a metaclass.
- public static boolean isMetaclass(Type type) {
- if (type instanceof Class) {
- return ((Class) type).isMetaclass();
- }
- return false;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Iterator; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.Type; + +/** + * Utility class for <code>org.eclipse.uml2.uml.Type</code><BR> + */ +public class TypeUtil { + + public final static String UNDEFINED_TYPE_NAME = "<Undefined>"; + + /** + * Get a string that displays the name of the type, and then its namespace. + * <p> + * For example: "String - UMLPrimitiveType" + * + * @return a string that displays information about the type + */ + public static String getInfoString(Type type) { + StringBuffer buffer = new StringBuffer(); + buffer.append(UMLLabelInternationalization.getInstance().getLabel(type)); + buffer.append(" - "); + String tmp = ""; + Iterator<Namespace> it = type.allNamespaces().iterator(); + while (it.hasNext()) { + Namespace namespace = it.next(); + if (it.hasNext()) { + tmp = NamedElement.SEPARATOR + UMLLabelInternationalization.getInstance().getLabel(namespace) + tmp; + } else { + tmp = UMLLabelInternationalization.getInstance().getLabel(namespace) + tmp; + } + } + buffer.append(tmp); + return buffer.toString(); + } + + /** + * + * + * @param type + * to check + * + * @return true if type is metaclass, else false + */ + @Deprecated + // use {@link Class#isMetaclass()} Check if a type is a metaclass. + public static boolean isMetaclass(Type type) { + if (type instanceof Class) { + return ((Class) type).isMetaclass(); + } + return false; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypedElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypedElementUtil.java index cf50dfb5aca..ee227ee94a1 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypedElementUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/TypedElementUtil.java @@ -1,26 +1,28 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.utils;
-
-import org.eclipse.uml2.uml.TypedElement;
-
-/**
- * Utility class for <code>org.eclipse.uml2.uml.TypedElement</code><BR>
- */
-public class TypedElementUtil {
-
- public static String getTypeAsString(TypedElement element) {
- return (element.getType() != null) ? element.getType().getName() : "<Undefined>";
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.TypedElement; + +/** + * Utility class for <code>org.eclipse.uml2.uml.TypedElement</code><BR> + */ +public class TypedElementUtil { + + public static String getTypeAsString(TypedElement element) { + return (element.getType() != null) ? UMLLabelInternationalization.getInstance().getLabel(element.getType()) : "<Undefined>"; + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ValueSpecificationUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ValueSpecificationUtil.java index 533941c1f97..ac4857301c8 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ValueSpecificationUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ValueSpecificationUtil.java @@ -9,6 +9,7 @@ * * Contributors: * Remi SCHNEKENBURGER (CEA LIST) Remi.schnekenburger@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ @@ -16,6 +17,7 @@ package org.eclipse.papyrus.uml.tools.utils; import java.util.Collection; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Duration; import org.eclipse.uml2.uml.Expression; @@ -49,6 +51,16 @@ public class ValueSpecificationUtil { * @param specification */ public static String getSpecificationValue(ValueSpecification specification) { + return getSpecificationValue(specification, false); + } + + /** + * Get a string representing of a ValueSpecification + * + * @param specification The Value specification. + * @param useInternationalization Boolean to determinate if the internationalization must be used for the string representation. + */ + public static String getSpecificationValue(final ValueSpecification specification, final boolean useInternationalization) { String value = ""; //$NON-NLS-1$ if (specification != null && specification.eClass() != null) { switch (specification.eClass().getClassifierID()) { @@ -75,7 +87,11 @@ public class ValueSpecificationUtil { break; case UMLPackage.INSTANCE_VALUE: if (((InstanceValue) specification).getInstance() != null) { - value = ((InstanceValue) specification).getInstance().getName(); + if(useInternationalization){ + value = UMLLabelInternationalization.getInstance().getLabel(((InstanceValue) specification).getInstance()); + }else{ + value = ((InstanceValue) specification).getInstance().getName(); + } } break; case UMLPackage.EXPRESSION: @@ -104,7 +120,11 @@ public class ValueSpecificationUtil { if (durationExpr.getExpr() != null) { value = getSpecificationValue(durationExpr.getExpr()); } else if (durationExpr.getObservations().size() > 0) { - value = durationExpr.getObservations().get(0).getName(); + if(useInternationalization){ + value = UMLLabelInternationalization.getInstance().getLabel(durationExpr.getObservations().get(0)); + }else{ + value = durationExpr.getObservations().get(0).getName(); + } } break; case UMLPackage.TIME_EXPRESSION: @@ -112,7 +132,11 @@ public class ValueSpecificationUtil { if (timeExpr.getExpr() != null) { value = getSpecificationValue(timeExpr.getExpr()); } else if (timeExpr.getObservations().size() > 0) { - value = timeExpr.getObservations().get(0).getName(); + if(useInternationalization){ + value = UMLLabelInternationalization.getInstance().getLabel(timeExpr.getObservations().get(0)); + }else{ + value = timeExpr.getObservations().get(0).getName(); + } } break; case UMLPackage.INTERVAL: @@ -148,7 +172,7 @@ public class ValueSpecificationUtil { if (specification != null) { ValueSpecification spe = specification.getSpecification(); if (spe != null) { - value = getSpecificationValue(spe); + value = getSpecificationValue(spe, true); } } return value; diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF index 272a6228f2e..33c9f50b0bb 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF @@ -24,7 +24,9 @@ Require-Bundle: org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)";visibility:= org.eclipse.uml2.uml.validation;bundle-version="[5.0.0,6.0.0)", org.eclipse.papyrus.infra.services.edit.ui;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.core;bundle-version="[2.2.0,3.0.0)", - org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/Activator.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/Activator.java index 26b5d8d7420..b4a52e99ec3 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/Activator.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/Activator.java @@ -11,6 +11,7 @@ * Patrick Tessier (CEA LIST) - Initial API and implementation * Christian W. Damus (CEA) - bug 425270 * Christian W. Damus - bug 469464 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * /*****************************************************************************/ package org.eclipse.papyrus.uml.tools; @@ -25,6 +26,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; import org.eclipse.papyrus.uml.tools.utils.ElementUtil; import org.eclipse.papyrus.uml.tools.utils.ImageUtil; import org.eclipse.swt.graphics.Image; @@ -99,7 +101,9 @@ public class Activator extends AbstractUIPlugin { } protected ComposedAdapterFactory createAdapterFactory() { - return new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + final ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + composedAdapterFactory.insertAdapterFactory(new InternationalizationUMLItemProviderAdapterFactory()); + return composedAdapterFactory; } public AdapterFactory getItemProviderAdapterFactory() { diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/namereferences/NameReferencesHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/namereferences/NameReferencesHelper.java index d965ed6e27b..4ae88854426 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/namereferences/NameReferencesHelper.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/namereferences/NameReferencesHelper.java @@ -1,231 +1,233 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.namereferences;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.papyrus.infra.emf.utils.TextReferencesHelper;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A Parser Helper to replace references to NamedElements in a text
- *
- * It relies on a parser to search references and replace them with a text value
- *
- * @author Camille Letavernier
- *
- */
-// FIXME: Reimplement listeners mechanism. The listeners are not correctly added/removed (Especially when the referenced element is moved)
-// FIXME: URI changes are not properly detected (ControlMode)
-public class NameReferencesHelper extends TextReferencesHelper {
-
- private ChangeDispatcher listener = new ChangeDispatcher();
-
- public NameReferencesHelper() {
- super();
- // Empty
- }
-
- /**
- *
- * @param baseResource
- * The resource against which the link uris will be resolved
- */
- public NameReferencesHelper(Resource baseResource) {
- super(baseResource);
- }
-
- @Override
- protected String decorate(String text) {
- return "<u>" + text + "</u>";
- }
-
- @Override
- public String replaceReferences(String text) {
- listener.clearElementListeners(); // Remove all previous listeners before adding new ones
- dispatch = false;
- String result = super.replaceReferences(text);
- dispatch = true;
- return result;
- }
-
- /**
- * Returns the String replacement for the given element
- */
- @Override
- protected String getReplacement(EObject elementToReplace, String cachedValue) {
- if (elementToReplace == null) {
- return UNKNOWN_ELEMENT;
- }
-
- if (elementToReplace.eIsProxy()) {
- return PROXY_ELEMENT;
- }
-
- if (elementToReplace instanceof NamedElement) {
- NamedElement target = (NamedElement) elementToReplace;
-
- if (installListeners()) {
-
- if (!target.eAdapters().contains(listener)) {
- // Listen on value changes (NamedElement#name)
- listener.listenOnElement(target);
- }
-
- if (!target.eResource().eAdapters().contains(listener)) {
- // Listen on resource changes (Deletion)
- listener.listenOnElement(target.eResource());
- }
-
- if (target.eContainer() != null && !target.eContainer().eAdapters().contains(listener)) {
- // Listen on the contents of the parent element (Deletion)
- listener.listenOnElement(target.eContainer());
- }
- }
-
- if (target.getName() == null) {
- return "UNNAMED";
- } else {
- return target.getName();
- }
- }
-
- if (cachedValue == null) {
- return UNKNOWN_ELEMENT;
- }
-
- return cachedValue + " (Missing)";
- }
-
- private boolean dispatch = true;
-
- private boolean installListeners() {
- return !this.listener.listeners.isEmpty();
- }
-
- public void addListener(Adapter listener) {
- this.listener.addListener(listener);
- }
-
- public void removeListener(Adapter listener) {
- this.listener.removeListener(listener);
- }
-
- public void dispose() {
- this.listener.dispose();
- this.resourceSet = null;
- this.baseResource = null;
- }
-
- private class ChangeDispatcher extends AdapterImpl {
-
- private final Set<Adapter> listeners = new HashSet<Adapter>();
-
- private final Set<Notifier> listenOnElements = new HashSet<Notifier>();
-
- @Override
- public void notifyChanged(Notification msg) {
- // A change occurred on one of the referenced elements
- try {
- if (dispatch && isValidNotification(msg)) {
- for (Adapter listener : listeners) {
- try {
- listener.notifyChanged(msg);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // The current implementation is not strict. This will lead to useless refreshes
- // (e.g. each time the contents of the parent change, or when the name of the parent changes)
- // The NameReferencesHelper should probably handle its own listeners, and call a
- // refresh/listener method when updated, to be more precise
- boolean isValidNotification(Notification msg) {
- if (!listenOnElements.contains(msg.getNotifier())) {
- Object notifierObject = msg.getNotifier();
- if (notifierObject instanceof Notifier) {
- ((Notifier) notifierObject).eAdapters().remove(this);
- }
- return false;
- }
-
- // Name of a NamedElement
- if (msg.getFeature() == UMLPackage.eINSTANCE.getNamedElement_Name()) {
- return true;
- }
-
- // Resource contents
- if (msg.getNotifier() instanceof Resource) {
- return true;
- }
-
- // Parent contents
- Object feature = msg.getFeature();
- if (feature instanceof EReference) {
- if (((EReference) feature).isContainment()) {
- return true;
- }
- }
-
- return false;
- }
-
- public void addListener(Adapter listener) {
- listeners.add(listener);
- }
-
- public void removeListener(Adapter listener) {
- listeners.remove(listener);
- }
-
- private void listenOnElement(Notifier element) {
- if (element.eAdapters().contains(this)) {
- return;
- }
-
- listenOnElements.add(element);
- element.eAdapters().add(this);
- }
-
- private void clearElementListeners() {
- List<Notifier> notifiers = new LinkedList<Notifier>(listenOnElements);
- for (Notifier notifier : notifiers) {
- notifier.eAdapters().remove(this);
- }
- listenOnElements.clear();
- }
-
- public void dispose() {
- listeners.clear();
- clearElementListeners();
- }
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.namereferences; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.papyrus.infra.emf.utils.TextReferencesHelper; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A Parser Helper to replace references to NamedElements in a text + * + * It relies on a parser to search references and replace them with a text value + * + * @author Camille Letavernier + * + */ +// FIXME: Reimplement listeners mechanism. The listeners are not correctly added/removed (Especially when the referenced element is moved) +// FIXME: URI changes are not properly detected (ControlMode) +public class NameReferencesHelper extends TextReferencesHelper { + + private ChangeDispatcher listener = new ChangeDispatcher(); + + public NameReferencesHelper() { + super(); + // Empty + } + + /** + * + * @param baseResource + * The resource against which the link uris will be resolved + */ + public NameReferencesHelper(Resource baseResource) { + super(baseResource); + } + + @Override + protected String decorate(String text) { + return "<u>" + text + "</u>"; + } + + @Override + public String replaceReferences(String text) { + listener.clearElementListeners(); // Remove all previous listeners before adding new ones + dispatch = false; + String result = super.replaceReferences(text); + dispatch = true; + return result; + } + + /** + * Returns the String replacement for the given element + */ + @Override + protected String getReplacement(EObject elementToReplace, String cachedValue) { + if (elementToReplace == null) { + return UNKNOWN_ELEMENT; + } + + if (elementToReplace.eIsProxy()) { + return PROXY_ELEMENT; + } + + if (elementToReplace instanceof NamedElement) { + NamedElement target = (NamedElement) elementToReplace; + + if (installListeners()) { + + if (!target.eAdapters().contains(listener)) { + // Listen on value changes (NamedElement#name) + listener.listenOnElement(target); + } + + if (!target.eResource().eAdapters().contains(listener)) { + // Listen on resource changes (Deletion) + listener.listenOnElement(target.eResource()); + } + + if (target.eContainer() != null && !target.eContainer().eAdapters().contains(listener)) { + // Listen on the contents of the parent element (Deletion) + listener.listenOnElement(target.eContainer()); + } + } + + if (target.getName() == null) { + return "UNNAMED"; + } else { + return UMLLabelInternationalization.getInstance().getLabel(target); + } + } + + if (cachedValue == null) { + return UNKNOWN_ELEMENT; + } + + return cachedValue + " (Missing)"; + } + + private boolean dispatch = true; + + private boolean installListeners() { + return !this.listener.listeners.isEmpty(); + } + + public void addListener(Adapter listener) { + this.listener.addListener(listener); + } + + public void removeListener(Adapter listener) { + this.listener.removeListener(listener); + } + + public void dispose() { + this.listener.dispose(); + this.resourceSet = null; + this.baseResource = null; + } + + private class ChangeDispatcher extends AdapterImpl { + + private final Set<Adapter> listeners = new HashSet<Adapter>(); + + private final Set<Notifier> listenOnElements = new HashSet<Notifier>(); + + @Override + public void notifyChanged(Notification msg) { + // A change occurred on one of the referenced elements + try { + if (dispatch && isValidNotification(msg)) { + for (Adapter listener : listeners) { + try { + listener.notifyChanged(msg); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + // The current implementation is not strict. This will lead to useless refreshes + // (e.g. each time the contents of the parent change, or when the name of the parent changes) + // The NameReferencesHelper should probably handle its own listeners, and call a + // refresh/listener method when updated, to be more precise + boolean isValidNotification(Notification msg) { + if (!listenOnElements.contains(msg.getNotifier())) { + Object notifierObject = msg.getNotifier(); + if (notifierObject instanceof Notifier) { + ((Notifier) notifierObject).eAdapters().remove(this); + } + return false; + } + + // Name of a NamedElement + if (msg.getFeature() == UMLPackage.eINSTANCE.getNamedElement_Name()) { + return true; + } + + // Resource contents + if (msg.getNotifier() instanceof Resource) { + return true; + } + + // Parent contents + Object feature = msg.getFeature(); + if (feature instanceof EReference) { + if (((EReference) feature).isContainment()) { + return true; + } + } + + return false; + } + + public void addListener(Adapter listener) { + listeners.add(listener); + } + + public void removeListener(Adapter listener) { + listeners.remove(listener); + } + + private void listenOnElement(Notifier element) { + if (element.eAdapters().contains(this)) { + return; + } + + listenOnElements.add(element); + element.eAdapters().add(this); + } + + private void clearElementListeners() { + List<Notifier> notifiers = new LinkedList<Notifier>(listenOnElements); + for (Notifier notifier : notifiers) { + notifier.eAdapters().remove(this); + } + listenOnElements.clear(); + } + + public void dispose() { + listeners.clear(); + clearElementListeners(); + } + } + +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java index 371c9efe2ab..be1bc75f6d8 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java @@ -9,6 +9,7 @@ * Contributors: * Patrick Tessier (CEA LIST) - Initial API and implementation * Christian W. Damus (CEA) - bug 425270 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * /*****************************************************************************/ package org.eclipse.papyrus.uml.tools.providers; @@ -17,10 +18,12 @@ import java.util.Iterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.gmf.runtime.notation.DecorationNode; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.emf.utils.TextReferencesHelper; import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.Activator; import org.eclipse.papyrus.uml.tools.namereferences.NameReferencesHelper; import org.eclipse.papyrus.uml.tools.utils.ImageUtil; @@ -36,7 +39,6 @@ import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.InstanceValue; import org.eclipse.uml2.uml.LiteralNull; import org.eclipse.uml2.uml.LiteralString; -import org.eclipse.uml2.uml.MultiplicityElement; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Operation; import org.eclipse.uml2.uml.OperationTemplateParameter; @@ -51,7 +53,6 @@ import org.eclipse.uml2.uml.Type; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.ValueSpecification; import org.eclipse.uml2.uml.edit.UMLEditPlugin; -import org.eclipse.uml2.uml.edit.providers.MultiplicityElementItemProvider; import org.eclipse.uml2.uml.util.UMLUtil; /** @@ -157,12 +158,12 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider appendString(text, "/"); //$NON-NLS-1$ } - final String label = property.getLabel(shouldTranslate()); + final String label = UMLLabelInternationalization.getInstance().getLabel(property, shouldTranslate()); if (!UML2Util.isEmpty(label)) { appendString(text, label); } else if (property.getAssociation() != null && type != null) { - final String typeName = type.getName(); + final String typeName = UMLLabelInternationalization.getInstance().getLabel(type, shouldTranslate()); if (!UML2Util.isEmpty(typeName)) { if(property instanceof ExtensionEnd){ @@ -307,14 +308,16 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider if (value != null) { if (((NamedElement) element).isSetName() && null != ((NamedElement) element).getName()) { - return ((NamedElement) element).getName() + "=" + value; //$NON-NLS-1$ + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement) element), shouldTranslate()) + "=" + value; //$NON-NLS-1$ } else { + // TODO: Maybe use labelInternationalization? But how qualifiedName must be set? return value; } } else { if (((NamedElement) element).isSetName() && null != ((NamedElement) element).getName()) { - return ((NamedElement) element).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement) element), shouldTranslate()); } else { + // TODO: Maybe use labelInternationalization? But how qualifiedName must be set? return ""; //$NON-NLS-1$ } } @@ -339,7 +342,7 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider String out = ""; if (templateParam.getParameteredElement() instanceof NamedElement) { NamedElement namedElement = (NamedElement) templateParam.getParameteredElement(); - out = namedElement.getName() + ": " + namedElement.eClass().getName(); + out = UMLLabelInternationalization.getInstance().getLabel(namedElement, shouldTranslate()) + ": " + namedElement.eClass().getName(); } if (templateParam instanceof OperationTemplateParameter) { @@ -351,7 +354,7 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider if (!((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().isEmpty()) { out = out + ">"; for (int i = 0; i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size(); i++) { - out = out + ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i).getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().get(i), shouldTranslate()); if (i < ((ClassifierTemplateParameter) templateParam).getConstrainingClassifiers().size() - 1) { out = out + ", "; } @@ -362,7 +365,7 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider if (templateParam.getDefault() instanceof Operation) { out = out + "=" + displayOperation((Operation) templateParam.getDefault()); } else if (templateParam.getDefault() instanceof NamedElement) { - out = out + "=" + ((NamedElement) templateParam.getDefault()).getName(); + out = out + "=" + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) templateParam.getDefault()), shouldTranslate()); } return out; } @@ -374,10 +377,10 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider String out = ""; TemplateParameterSubstitution substitution = (TemplateParameterSubstitution) element; if (substitution.getFormal() != null && substitution.getFormal().getParameteredElement() instanceof NamedElement) { - out = out + ((NamedElement) substitution.getFormal().getParameteredElement()).getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) substitution.getFormal().getParameteredElement()), shouldTranslate()); } if (substitution.getActual() instanceof NamedElement) { - out = out + " -> " + ((NamedElement) substitution.getActual()).getName() + "\n"; + out = out + " -> " + UMLLabelInternationalization.getInstance().getLabel(((NamedElement) substitution.getActual()), shouldTranslate()) + "\n"; } return out; } @@ -471,11 +474,11 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider * @return the label */ protected String displayOperation(Operation op) { - String out = op.getName() + "("; + String out = UMLLabelInternationalization.getInstance().getLabel(op, shouldTranslate()) + "("; Iterator<Parameter> iter = op.getOwnedParameters().iterator(); while (iter.hasNext()) { Parameter param = iter.next(); - out = out + param.getName(); + out = out + UMLLabelInternationalization.getInstance().getLabel(param, shouldTranslate()); if (!param.equals(op.getOwnedParameters().get(op.getOwnedParameters().size() - 1))) { out = out + ", "; } diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassContentProvider.java index 94890932e8f..699c9e61d61 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassContentProvider.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassContentProvider.java @@ -9,6 +9,7 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.uml.tools.providers; @@ -19,6 +20,7 @@ import java.util.List; import org.eclipse.papyrus.infra.widgets.providers.AbstractFilteredContentProvider; import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.tools.utils.ElementUtil; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Element; @@ -57,11 +59,11 @@ public class UMLMetaclassContentProvider extends AbstractFilteredContentProvider public int compare(Class firstClass, Class secondClass) { // Use default lexicographically sorter of String based on Class name - String firstName = firstClass.getName(); + String firstName = UMLLabelInternationalization.getInstance().getLabel(firstClass); if (firstName == null) { return 0; } - return firstName.compareTo(secondClass.getName()); + return firstName.compareTo(UMLLabelInternationalization.getInstance().getLabel(secondClass)); } }); diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassLabelProvider.java index 8734dc10802..90372dfde59 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassLabelProvider.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLMetaclassLabelProvider.java @@ -1,78 +1,80 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.providers;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Label provider for UML Metaclass
- *
- * @author Vincent Lorenzo
- *
- */
-public class UMLMetaclassLabelProvider extends UMLEClassLabelProvider {
-
- /**
- *
- * @see org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider#accept(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean accept(Object element) {
- if (element instanceof Class) {
- return ((Class) element).isMetaclass();
- }
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider#getText(org.eclipse.emf.ecore.EObject)
- *
- * @param element
- * @return
- */
- @Override
- protected String getText(final EObject element) {
- return ((Class) element).getName();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider#getImage(org.eclipse.emf.ecore.EObject)
- *
- * @param element
- * @return
- */
- @Override
- protected Image getImage(EObject element) {
- EClass umlEClass = null;
- if (element instanceof Class) {
- EClassifier classifier = UMLPackage.eINSTANCE.getEClassifier(((Class) element).getName());
- if (classifier instanceof EClass) {
- umlEClass = (EClass) classifier;
- return super.getImage(umlEClass);
- }
- }
- return null;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.providers; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Label provider for UML Metaclass + * + * @author Vincent Lorenzo + * + */ +public class UMLMetaclassLabelProvider extends UMLEClassLabelProvider { + + /** + * + * @see org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider#accept(java.lang.Object) + * + * @param element + * @return + */ + @Override + public boolean accept(Object element) { + if (element instanceof Class) { + return ((Class) element).isMetaclass(); + } + return false; + } + + /** + * + * @see org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider#getText(org.eclipse.emf.ecore.EObject) + * + * @param element + * @return + */ + @Override + protected String getText(final EObject element) { + return UMLLabelInternationalization.getInstance().getLabel(((Class) element)); + } + + /** + * + * @see org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider#getImage(org.eclipse.emf.ecore.EObject) + * + * @param element + * @return + */ + @Override + protected Image getImage(EObject element) { + EClass umlEClass = null; + if (element instanceof Class) { + EClassifier classifier = UMLPackage.eINSTANCE.getEClassifier(((Class) element).getName()); + if (classifier instanceof EClass) { + umlEClass = (EClass) classifier; + return super.getImage(umlEClass); + } + } + return null; + } + +}
\ No newline at end of file diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java index c6516300371..917eddc6a80 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java @@ -1,220 +1,221 @@ -/*
- * Copyright (c) 2014 CEA and others.
- *
- * 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:
- * Christian W. Damus (CEA) - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.infra.gmfdiag.common.utils;
-
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.infra.core.resource.TransactionalEditingDomainManager;
-import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Property;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-
-import junit.framework.AssertionFailedError;
-
-
-/**
- * Test suite for the {@link GMFUnsafe} class.
- */
-public class GMFUnsafeTest extends AbstractPapyrusTest {
-
- @Rule
- public final TestName testName = new TestName();
-
- private TransactionalEditingDomain domain;
-
- private Model model;
-
- private Class classA;
-
- private boolean doIt;
-
- @Test
- public void testWrite_runnable() throws Exception {
- if (doIt()) {
- GMFUnsafe.write(domain, new Runnable() {
-
- public void run() {
- createAttribute();
- }
- });
- }
- }
-
- @Test
- public void testWrite_command() throws Exception {
- if (doIt()) {
- GMFUnsafe.write(domain, new AbstractCommand() {
-
- public void redo() {
- createAttribute();
- }
-
- public void execute() {
- createAttribute();
- }
- });
- }
- }
-
- @Test
- public void testWrite_gmfCommand() throws Exception {
- if (doIt()) {
- GMFUnsafe.write(domain, new AbstractTransactionalCommand(domain, "Test", Collections.emptyList()) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- createAttribute();
- return CommandResult.newOKCommandResult();
- }
- });
- }
- }
-
- @Test
- public void testWrap() throws Exception {
- if (doIt()) {
- GMFUnsafe.wrap(domain, new AbstractCommand() {
-
- public void redo() {
- createAttribute();
- }
-
- public void execute() {
- createAttribute();
- }
- }).execute();
- }
- }
-
- //
- // Test framework
- //
-
- @Before
- public void createFixture() throws Exception {
- ResourceSet rset = new ResourceSetImpl();
- domain = TransactionalEditingDomainManager.createTransactionalEditingDomain(rset);
-
- // This will be treated by the editing domain as a read-only resource (except that we run unprotected transactions)
- Resource res = rset.createResource(URI.createURI("bogus://test/model.uml"));
-
- InputStream input = getClass().getResourceAsStream("model.uml");
- try {
- res.load(input, null);
- } finally {
- input.close();
- }
-
- model = (Model) res.getContents().get(0);
- classA = (Class) model.getOwnedType("A");
- }
-
- @After
- public void destroyFixture() {
- ResourceSet rset = domain.getResourceSet();
-
- for (Resource next : rset.getResources()) {
- next.unload();
- next.eAdapters().clear();
- }
- rset.getResources().clear();
- rset.eAdapters().clear();
-
- domain.dispose();
-
- model = null;
- classA = null;
- }
-
- Property createAttribute() {
- return classA.createOwnedAttribute("related", classA);
- }
-
- void assertProperty() {
- Property related = classA.getOwnedAttribute("related", classA);
- assertThat(related, notNullValue());
- }
-
- boolean doIt() {
- if (!doIt) {
- try {
- domain.runExclusive(new Runnable() {
-
- public void run() {
- try {
- GMFUnsafe.write(domain, new Runnable() {
-
- public void run() {
- doIt = true;
-
- try {
- // Reflectively re-invoke the test method. This will result in it execution of its body because
- // the re-entrant call to doIt() will return true this time
- try {
- Object test = GMFUnsafeTest.this;
- Method method = test.getClass().getDeclaredMethod(testName.getMethodName());
- method.invoke(test);
- } catch (Exception e) {
- if ((e instanceof InvocationTargetException) && (((InvocationTargetException) e).getTargetException() instanceof AssertionFailedError)) {
- throw (AssertionFailedError) ((InvocationTargetException) e).getTargetException();
- }
- e.printStackTrace();
- fail("Reflective invocation of test failed: " + e.getLocalizedMessage());
- }
- } finally {
- doIt = false;
- }
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- fail("Unsafe write failed: " + e.getLocalizedMessage());
- }
-
- assertProperty();
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- fail("Read transaction failed: " + e.getLocalizedMessage());
- }
- }
-
- return doIt;
- }
-}
+/* + * Copyright (c) 2014 CEA and others. + * + * 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: + * Christian W. Damus (CEA) - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + */ +package org.eclipse.papyrus.infra.gmfdiag.common.utils; + +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collections; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.command.AbstractCommand; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.papyrus.infra.core.resource.TransactionalEditingDomainManager; +import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.Property; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import junit.framework.AssertionFailedError; + + +/** + * Test suite for the {@link GMFUnsafe} class. + */ +public class GMFUnsafeTest extends AbstractPapyrusTest { + + @Rule + public final TestName testName = new TestName(); + + private TransactionalEditingDomain domain; + + private Model model; + + private Class classA; + + private boolean doIt; + + @Test + public void testWrite_runnable() throws Exception { + if (doIt()) { + GMFUnsafe.write(domain, new Runnable() { + + public void run() { + createAttribute(); + } + }); + } + } + + @Test + public void testWrite_command() throws Exception { + if (doIt()) { + GMFUnsafe.write(domain, new AbstractCommand() { + + public void redo() { + createAttribute(); + } + + public void execute() { + createAttribute(); + } + }); + } + } + + @Test + public void testWrite_gmfCommand() throws Exception { + if (doIt()) { + GMFUnsafe.write(domain, new AbstractTransactionalCommand(domain, "Test", Collections.emptyList()) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + createAttribute(); + return CommandResult.newOKCommandResult(); + } + }); + } + } + + @Test + public void testWrap() throws Exception { + if (doIt()) { + GMFUnsafe.wrap(domain, new AbstractCommand() { + + public void redo() { + createAttribute(); + } + + public void execute() { + createAttribute(); + } + }).execute(); + } + } + + // + // Test framework + // + + @Before + public void createFixture() throws Exception { + ResourceSet rset = new ResourceSetImpl(); + domain = TransactionalEditingDomainManager.createTransactionalEditingDomain(rset); + + // This will be treated by the editing domain as a read-only resource (except that we run unprotected transactions) + Resource res = rset.createResource(URI.createURI("bogus://test/model.uml")); + + InputStream input = getClass().getResourceAsStream("model.uml"); + try { + res.load(input, null); + } finally { + input.close(); + } + + model = (Model) res.getContents().get(0); + classA = (Class) model.getOwnedType("A"); + } + + @After + public void destroyFixture() { + ResourceSet rset = domain.getResourceSet(); + + for (Resource next : rset.getResources()) { + next.unload(); + next.eAdapters().clear(); + } + rset.getResources().clear(); + rset.eAdapters().clear(); + + domain.dispose(); + + model = null; + classA = null; + } + + Property createAttribute() { + return classA.createOwnedAttribute("related", classA); + } + + void assertProperty() { + Property related = classA.getOwnedAttribute("related", classA); + assertThat(related, notNullValue()); + } + + boolean doIt() { + if (!doIt) { + try { + domain.runExclusive(new Runnable() { + + public void run() { + try { + GMFUnsafe.write(domain, new Runnable() { + + public void run() { + doIt = true; + + try { + // Reflectively re-invoke the test method. This will result in it execution of its body because + // the re-entrant call to doIt() will return true this time + try { + Object test = GMFUnsafeTest.this; + Method method = test.getClass().getDeclaredMethod(testName.getMethodName()); + method.invoke(test); + } catch (Exception e) { + if ((e instanceof InvocationTargetException) && (((InvocationTargetException) e).getTargetException() instanceof AssertionFailedError)) { + throw (AssertionFailedError) ((InvocationTargetException) e).getTargetException(); + } + e.printStackTrace(); + fail("Reflective invocation of test failed: " + e.getLocalizedMessage()); + } + } finally { + doIt = false; + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + fail("Unsafe write failed: " + e.getLocalizedMessage()); + } + + assertProperty(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + fail("Read transaction failed: " + e.getLocalizedMessage()); + } + } + + return doIt; + } +}
\ No newline at end of file diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java index 588101b9801..6cd665a07f7 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java @@ -1,118 +1,120 @@ -/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST, Christian W. Damus, and others.
- *
- *
- * 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:
- * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
- * Christian W. Damus - bug 473183
- /*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz.test.canonical;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.draw2d.text.FlowPage;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.draw2d.ui.text.TextFlowEx;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomUMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.clazz.test.IClassDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.tests.canonical.StateNotShareable;
-import org.eclipse.papyrus.uml.diagram.tests.canonical.TestChildLabel;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Test;
-
-/**
- * this class is used to test if feature are a representation for static
- *
- */
-@StateNotShareable
-public class TestStaticFeatureRepresentation extends TestChildLabel {
-
- @Override
- public DiagramUpdater getDiagramUpdater() {
- return CustomUMLDiagramUpdater.INSTANCE;
- }
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
- }
-
- @Override
- protected String getProjectName() {
- return IClassDiagramTestsConstants.PROJECT_NAME;
- }
-
- @Override
- protected String getFileName() {
- return IClassDiagramTestsConstants.FILE_NAME;
- }
-
- @Test
- public void testStaticOperation() {
- testToCreateATopNode(UMLElementTypes.Class_Shape);
- testToTestStaticoperation(UMLElementTypes.Operation_ClassOperationLabel, ClassOperationCompartmentEditPart.VISUAL_ID);
- }
-
- @Test
- public void testStaticProperty() {
- testToCreateATopNode(UMLElementTypes.Class_Shape);
- testToTestStaticoperation(UMLElementTypes.Property_ClassAttributeLabel, ClassAttributeCompartmentEditPart.VISUAL_ID);
- }
-
- protected void testToTestStaticoperation(IElementType type, String containerType) {
- ListCompartmentEditPart compartment = null;
- int index = 0;
- while (compartment == null && index < getTopEditPart().getChildren().size()) {
- if ((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View) ((ListCompartmentEditPart) (getTopEditPart().getChildren().get(index))).getModel()).getType().equals(containerType))) {
- compartment = (ListCompartmentEditPart) (getTopEditPart().getChildren().get(index));
- }
- index++;
- }
- assertTrue("Container not found", compartment != null);
- // CREATION
- assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
- assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
- CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command = compartment.getCommand(requestcreation);
- assertNotNull(CREATION + COMMAND_NULL, command);
- assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
- // creation of label
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
- assertTrue("ceated editpart is a feature editpart", ((compartment.getChildren().get(0)) instanceof UMLCompartmentEditPart));
- UMLCompartmentEditPart featureEditPart = (UMLCompartmentEditPart) compartment.getChildren().get(0);
- // make it static
- SetCommand setStaticOperation = new SetCommand(diagramEditor.getEditingDomain(), featureEditPart.resolveSemanticElement(), UMLPackage.eINSTANCE.getFeature_IsStatic(), true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(new EMFtoGMFCommandWrapper(setStaticOperation)));
- TextFlowEx label = (TextFlowEx) ((FlowPage) featureEditPart.getFigure().getChildren().get(0)).getChildren().get(0);
- featureEditPart.refresh();
- // the semantic element is static
- assertTrue("the feature is static", ((Feature) featureEditPart.resolveSemanticElement()).isStatic());
- // the graphical element is underlined
- assertTrue("the figigure is drawn as static", label.isTextUnderlined());
- }
-}
+/***************************************************************************** + * Copyright (c) 2013, 2015 CEA LIST, Christian W. Damus, and others. + * + * + * 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: + * Nizar GUEDIDI (CEA LIST) - Initial API and implementation + * Christian W. Damus - bug 473183 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + /*****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.clazz.test.canonical; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.eclipse.draw2d.text.FlowPage; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; +import org.eclipse.gmf.runtime.draw2d.ui.text.TextFlowEx; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater; +import org.eclipse.papyrus.commands.ICreationCommand; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand; +import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomUMLDiagramUpdater; +import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.clazz.test.IClassDiagramTestsConstants; +import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.tests.canonical.StateNotShareable; +import org.eclipse.papyrus.uml.diagram.tests.canonical.TestChildLabel; +import org.eclipse.uml2.uml.Feature; +import org.eclipse.uml2.uml.UMLPackage; +import org.junit.Test; + +/** + * this class is used to test if feature are a representation for static + * + */ +@StateNotShareable +public class TestStaticFeatureRepresentation extends TestChildLabel { + + @Override + public DiagramUpdater getDiagramUpdater() { + return CustomUMLDiagramUpdater.INSTANCE; + } + + @Override + protected ICreationCommand getDiagramCommandCreation() { + return new CreateClassDiagramCommand(); + } + + @Override + protected String getProjectName() { + return IClassDiagramTestsConstants.PROJECT_NAME; + } + + @Override + protected String getFileName() { + return IClassDiagramTestsConstants.FILE_NAME; + } + + @Test + public void testStaticOperation() { + testToCreateATopNode(UMLElementTypes.Class_Shape); + testToTestStaticoperation(UMLElementTypes.Operation_ClassOperationLabel, ClassOperationCompartmentEditPart.VISUAL_ID); + } + + @Test + public void testStaticProperty() { + testToCreateATopNode(UMLElementTypes.Class_Shape); + testToTestStaticoperation(UMLElementTypes.Property_ClassAttributeLabel, ClassAttributeCompartmentEditPart.VISUAL_ID); + } + + protected void testToTestStaticoperation(IElementType type, String containerType) { + ListCompartmentEditPart compartment = null; + int index = 0; + while (compartment == null && index < getTopEditPart().getChildren().size()) { + if ((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View) ((ListCompartmentEditPart) (getTopEditPart().getChildren().get(index))).getModel()).getType().equals(containerType))) { + compartment = (ListCompartmentEditPart) (getTopEditPart().getChildren().get(index)); + } + index++; + } + assertTrue("Container not found", compartment != null); + // CREATION + assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0); + assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0); + CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint()); + Command command = compartment.getCommand(requestcreation); + assertNotNull(CREATION + COMMAND_NULL, command); + assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE); + assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true); + // creation of label + diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command); + assertTrue(CREATION + TEST_THE_EXECUTION, compartment.getChildren().size() == 1); + assertTrue("ceated editpart is a feature editpart", ((compartment.getChildren().get(0)) instanceof UMLCompartmentEditPart)); + UMLCompartmentEditPart featureEditPart = (UMLCompartmentEditPart) compartment.getChildren().get(0); + // make it static + SetCommand setStaticOperation = new SetCommand(diagramEditor.getEditingDomain(), featureEditPart.resolveSemanticElement(), UMLPackage.eINSTANCE.getFeature_IsStatic(), true); + diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(new EMFtoGMFCommandWrapper(setStaticOperation))); + TextFlowEx label = (TextFlowEx) ((FlowPage) featureEditPart.getFigure().getChildren().get(0)).getChildren().get(0); + featureEditPart.refresh(); + // the semantic element is static + assertTrue("the feature is static", ((Feature) featureEditPart.resolveSemanticElement()).isStatic()); + // the graphical element is underlined + assertTrue("the figigure is drawn as static", label.isTextUnderlined()); + } +} |