diff options
40 files changed, 2469 insertions, 0 deletions
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.classpath b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.project b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.project new file mode 100644 index 00000000000..0fb8960ce36 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.adl4eclipsetool.assistant</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.settings/org.eclipse.jdt.core.prefs b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/.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.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..94c1c2af4cd --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.adl4eclipsetool.assistant;singleton:=true +Bundle-Version: 0.10.0.qualifier +Bundle-Activator: org.eclipse.papyrus.adltool.assistant.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf;bundle-version="2.6.0", + org.eclipse.emf.ecore, + org.eclipse.emf.transaction, + org.eclipse.gmf.runtime.diagram.ui, + org.eclipse.papyrus.editor, + org.eclipse.papyrus.infra.core, + org.eclipse.uml2.uml, + org.eclipse.papyrus.infra.emf, + org.eclipse.papyrus.adl4eclipsetool;bundle-version="0.10.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Export-Package: org.eclipse.papyrus.adltool.assistant + + diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/about.html b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/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>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/build.properties b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/build.properties new file mode 100644 index 00000000000..8665ac2ffec --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/build.properties @@ -0,0 +1,6 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.png b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.png Binary files differnew file mode 100644 index 00000000000..597790b0c2d --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.png diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.svg b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.svg new file mode 100644 index 00000000000..bffe0c3e0f5 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/img/adl.svg @@ -0,0 +1,355 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.2" + width="460.62991" + height="283.46457" + id="svg2" + inkscape:version="0.48.4 r9939" + sodipodi:docname="papyrus.svg"> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1306" + inkscape:window-height="767" + id="namedview53" + showgrid="false" + inkscape:zoom="0.76200001" + inkscape:cx="176.05836" + inkscape:cy="233.31647" + inkscape:window-x="493" + inkscape:window-y="93" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /> + <defs + id="defs4"> + <linearGradient + id="linearGradient3908"> + <stop + style="stop-color:#1a171a;stop-opacity:1;" + offset="0" + id="stop3910" /> + <stop + style="stop-color:#9c9e9f;stop-opacity:1;" + offset="1" + id="stop3912" /> + </linearGradient> + <linearGradient + id="linearGradient3818"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop3820" /> + <stop + style="stop-color:#98bf06;stop-opacity:1;" + offset="1" + id="stop3822" /> + </linearGradient> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3818" + id="radialGradient3832" + cx="622.66229" + cy="107.15185" + fx="622.66229" + fy="107.15185" + r="125.38313" + gradientUnits="userSpaceOnUse" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3818-1" + id="radialGradient3832-3" + cx="622.66229" + cy="107.15185" + fx="622.66229" + fy="107.15185" + r="125.38313" + gradientUnits="userSpaceOnUse" /> + <linearGradient + id="linearGradient3818-1"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop3820-6" /> + <stop + style="stop-color:#009bba;stop-opacity:1;" + offset="1" + id="stop3822-8" /> + </linearGradient> + <radialGradient + r="125.38313" + fy="107.15185" + fx="622.66229" + cy="107.15185" + cx="622.66229" + gradientUnits="userSpaceOnUse" + id="radialGradient3849" + xlink:href="#linearGradient3818-1" + inkscape:collect="always" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3914" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3916" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3918" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3920" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3922" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3925" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" + gradientTransform="matrix(-1,0,0,-1,1373.3832,351.87403)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3928" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" + gradientTransform="matrix(-1,0,0,-1,1373.3832,351.87403)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3931" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" + gradientTransform="matrix(-1,0,0,-1,1373.3832,351.87403)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3934" + gradientUnits="userSpaceOnUse" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" + gradientTransform="matrix(-1,0,0,-1,1373.3832,351.87403)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3940" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3946" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3952" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3958" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3818-1" + id="radialGradient3970" + gradientUnits="userSpaceOnUse" + cx="622.66229" + cy="107.15185" + fx="622.66229" + fy="107.15185" + r="125.38313" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3818" + id="radialGradient3972" + gradientUnits="userSpaceOnUse" + cx="622.66229" + cy="107.15185" + fx="622.66229" + fy="107.15185" + r="125.38313" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3974" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3976" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3978" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3908" + id="linearGradient3980" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,-1,945.59288,317.53945)" + x1="549.05366" + y1="177.90893" + x2="824.32955" + y2="177.90893" /> + </defs> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(0,-768.89631)" + id="layer2" /> + <g + id="g3960" + transform="matrix(0.93318676,0,0,0.93318676,8.4148818,11.649074)" + inkscape:export-xdpi="5.8753209" + inkscape:export-ydpi="5.8753209"> + <path + d="m 796.19109,174.89305 c 0,65.08738 -52.76374,117.85113 -117.85112,117.85113 -65.08738,0 -117.85113,-52.76375 -117.85113,-117.85113 0,-65.08738 52.76375,-117.851126 117.85113,-117.851126 65.08738,0 117.85112,52.763746 117.85112,117.851126 z" + sodipodi:ry="117.85113" + sodipodi:rx="117.85113" + sodipodi:cy="174.89305" + sodipodi:cx="678.33997" + id="path3030-8" + style="opacity:0.98999999;fill:url(#radialGradient3970);fill-opacity:1;stroke:none" + sodipodi:type="arc" + transform="translate(-451.91733,-35.262539)" /> + <path + transform="translate(-437.79032,-35.262539)" + d="m 796.19109,174.89305 c 0,65.08738 -52.76374,117.85113 -117.85112,117.85113 -65.08738,0 -117.85113,-52.76375 -117.85113,-117.85113 0,-65.08738 52.76375,-117.851126 117.85113,-117.851126 65.08738,0 117.85112,52.763746 117.85112,117.851126 z" + sodipodi:ry="117.85113" + sodipodi:rx="117.85113" + sodipodi:cy="174.89305" + sodipodi:cx="678.33997" + id="path3030" + style="opacity:0.98999999;fill:url(#radialGradient3972);fill-opacity:1;stroke:none" + sodipodi:type="arc" /> + <path + sodipodi:nodetypes="ccccc" + inkscape:connector-curvature="0" + id="path3868" + d="m 125.32217,164.47792 c 0.48084,2.47664 1.1607,4.92485 1.82692,7.375 l 244.0633,0 0,-7.375 z" + style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:url(#linearGradient3974);fill-opacity:1;stroke:none;stroke-width:7.36382484;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /> + <path + sodipodi:nodetypes="ccccc" + inkscape:connector-curvature="0" + id="path3868-2" + d="m 122.84277,145.44667 c 0.0647,2.45833 0.31139,4.91667 0.56547,7.375 l 247.80415,0 0,-7.375 z" + style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:url(#linearGradient3976);fill-opacity:1;stroke:none;stroke-width:7.36382484;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /> + <path + sodipodi:nodetypes="ccccc" + inkscape:connector-curvature="0" + id="path3868-7" + d="m 123.42274,126.44667 c -0.33255,2.44792 -0.44679,4.89583 -0.59447,7.34375 l 248.38412,0 0,-7.34375 z" + style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:url(#linearGradient3978);fill-opacity:1;stroke:none;stroke-width:7.36382484;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /> + <path + sodipodi:nodetypes="ccccc" + inkscape:connector-curvature="0" + id="path3868-71" + d="m 127.14909,107.41542 c -0.76224,2.48347 -1.29841,4.92927 -1.83417,7.375 l 245.89747,0 0,-7.375 z" + style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:url(#linearGradient3980);fill-opacity:1;stroke:none;stroke-width:7.36382484;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /> + </g> +</svg> diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.properties b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.properties new file mode 100644 index 00000000000..48b74745d72 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.properties @@ -0,0 +1,12 @@ +################################################################################# +# 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 +################################################################################## +pluginName=ADL4eclipseTool Assistant (Incubation) +providerName=Eclipse Modeling Project diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml new file mode 100644 index 00000000000..b49d94fdaa0 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <menu
+ icon="img/adl.png"
+ id="com.cea.papyrus.adl4eclipse.menu"
+ label="ADL4eclipse"
+ tooltip="ADL4eclipse">
+ </menu>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:com.cea.papyrus.adl4eclipse.menu">
+ <command
+ commandId="org.eclipse.papyrus.adltool.assistant.BundlesImportHandler"
+ id="org.eclipse.papyrus.adltool.assistant.BundlesImportHandler.popup"
+ label="Simple Architecture Snapshot"
+ style="push"
+ tooltip="Architecture Snapshot from the workspace">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.adltool.assistant.CompleteArchitectureHandler"
+ id="org.eclipse.papyrus.adltool.assistant.CompleteArchitectureHandler.popup"
+ label="Complete Architecture Snapshot"
+ style="push"
+ tooltip="Architecture Snapshot from the workspace">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.adltool.assistant.SimpleArchitecrureHandler"
+ id="org.eclipse.papyrus.adltool.assistant.BundlesImportHandler"
+ name="Simple Architecture Snapshot">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.adltool.assistant.CompleteArchitectureHandler"
+ id="org.eclipse.papyrus.adltool.assistant.CompleteArchitectureHandler"
+ name="Complete Architecture Snapshot">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.papyrus.adltool.assistant.Activator"></startup>
+ </extension>
+</plugin>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java new file mode 100644 index 00000000000..5531c00d970 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ADLToolAbstractHandler.java @@ -0,0 +1,123 @@ +/*****************************************************************************
+ * 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.adltool.assistant;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Abstract handler in order to connect to papyrus
+ *
+ */
+public abstract class ADLToolAbstractHandler extends AbstractHandler {
+
+ protected TransactionalEditingDomain transactionalEditingDomain=null;
+ protected PapyrusMultiDiagramEditor papyrusEditor;
+
+ /**
+ * getSelected element in the diagram or in hte model explorer
+ * @return Element or null
+ */
+ protected Element getSelection(){
+ org.eclipse.uml2.uml.Element selectedElement =null;
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService.getSelection();
+ //look for papyrus
+ int i=0;
+ while(!(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() instanceof IMultiDiagramEditor)&&i<100000) {
+ i++;
+ }
+ if((PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()instanceof IMultiDiagramEditor)){
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ papyrusEditor = ((PapyrusMultiDiagramEditor)editorPart);
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedobject = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedobject instanceof GraphicalEditPart) {
+ Object graphicalElement = ((GraphicalEditPart)selectedobject).getModel();
+ if((graphicalElement instanceof View) && ((View)graphicalElement).getElement() instanceof org.eclipse.uml2.uml.Element) {
+ selectedElement = (org.eclipse.uml2.uml.Element)((View)graphicalElement).getElement();
+ }
+ }
+ else if(selectedobject instanceof IAdaptable) {
+ EObject selectedEObject = (EObject)((IAdaptable)selectedobject).getAdapter(EObject.class);
+ if (selectedEObject instanceof org.eclipse.uml2.uml.Element){
+ selectedElement=(Element)selectedEObject;
+ }
+ }
+
+ }
+ return selectedElement;
+ }
+ return null;
+ }
+ /**
+ * getSelected element in the diagram or in hte model explorer
+ * @return Element or null
+ */
+ protected ArrayList<Element> getSelectionSet(){
+ ArrayList<Element> selectedSet =new ArrayList<Element>();
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService.getSelection();
+
+ //look for papyrus
+ int i=0;
+ while(!(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() instanceof IMultiDiagramEditor)&&i<100000) {
+ i++;
+ }
+ if((PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()instanceof IMultiDiagramEditor)){
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ papyrusEditor = ((PapyrusMultiDiagramEditor)editorPart);
+
+ if(selection instanceof IStructuredSelection) {
+ @SuppressWarnings("rawtypes")
+ Iterator selectedobjectIteractor = ((IStructuredSelection)selection).iterator();
+ while (selectedobjectIteractor.hasNext()) {
+ Object currentSelection = selectedobjectIteractor.next();
+ if(currentSelection instanceof GraphicalEditPart) {
+ Object graphicalElement = ((GraphicalEditPart)currentSelection).getModel();
+ if((graphicalElement instanceof View) && ((View)graphicalElement).getElement() instanceof org.eclipse.uml2.uml.Element) {
+ selectedSet.add( (org.eclipse.uml2.uml.Element)((View)graphicalElement).getElement());
+ }
+ }
+ else if(currentSelection instanceof IAdaptable) {
+ EObject selectedEObject = (EObject)((IAdaptable)currentSelection).getAdapter(EObject.class);
+ if (selectedEObject instanceof org.eclipse.uml2.uml.Element){
+ selectedSet.add((Element)selectedEObject);
+ }
+ }
+ }
+
+
+ }
+ return selectedSet;
+ }
+ return selectedSet;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java new file mode 100644 index 00000000000..8846e4faaf4 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * 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.adltool.assistant;
+
+import org.eclipse.ui.IStartup;
+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 implements IStartup{
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.adl4eclipsetool.assistant"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public void earlyStartup() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/CompleteArchitectureHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/CompleteArchitectureHandler.java new file mode 100644 index 00000000000..0ce0182e9ce --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/CompleteArchitectureHandler.java @@ -0,0 +1,76 @@ +
+/*****************************************************************************
+ * 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.adltool.assistant;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.adltool.command.CompleteArchitectureSnapshotCommand;
+import org.eclipse.papyrus.adltool.command.SimpleArchitectureSnapshotCommand;
+import org.eclipse.papyrus.adltool.designer.wizard.BundleArchitectureWizard;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+
+
+
+public class CompleteArchitectureHandler extends ADLToolAbstractHandler {
+
+ public CompleteArchitectureHandler() {
+ }
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Element selectedElement=getSelection();
+ ServicesRegistry registry=null;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException e1) {
+ e1.printStackTrace();
+ }
+ ModelSet modelSet;
+ try {
+ modelSet = registry.getService(ModelSet.class);
+ } catch (ServiceException e) {
+ throw new ExecutionException("Can't get ModelSet", e);
+ }
+ BundleArchitectureWizard bWizard=new BundleArchitectureWizard(false);
+ WizardDialog wizardDialog = new WizardDialog(new Shell(),bWizard);
+ if (wizardDialog.open() == Window.OK) {
+ TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain();
+ if( selectedElement instanceof Package){
+ CompleteArchitectureSnapshotCommand comd= new CompleteArchitectureSnapshotCommand(dom, (Package)selectedElement,bWizard.getSelectedBundle());
+ dom.getCommandStack().execute(comd);
+ }
+ }
+
+ return null;
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/SimpleArchitecrureHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/SimpleArchitecrureHandler.java new file mode 100644 index 00000000000..382fbe5853e --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/SimpleArchitecrureHandler.java @@ -0,0 +1,78 @@ +/*****************************************************************************
+ * 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.adltool.assistant;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.adltool.command.SimpleArchitectureSnapshotCommand;
+import org.eclipse.papyrus.adltool.designer.wizard.BundleArchitectureWizard;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+
+
+/**
+ * this handler is used to generate the architecture from workspace
+ *
+ */
+public class SimpleArchitecrureHandler extends ADLToolAbstractHandler {
+
+ public SimpleArchitecrureHandler() {
+ }
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Element selectedElement=getSelection();
+ ServicesRegistry registry=null;
+ try {
+ registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ } catch (ServiceException e1) {
+ e1.printStackTrace();
+ }
+ ModelSet modelSet;
+ try {
+ modelSet = registry.getService(ModelSet.class);
+ } catch (ServiceException e) {
+ throw new ExecutionException("Can't get ModelSet", e);
+ }
+ BundleArchitectureWizard bWizard=new BundleArchitectureWizard(true);
+ WizardDialog wizardDialog = new WizardDialog(new Shell(),bWizard);
+ if (wizardDialog.open() == Window.OK) {
+ TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain();
+ if( selectedElement instanceof Package){
+ SimpleArchitectureSnapshotCommand comd= new SimpleArchitectureSnapshotCommand(dom, (Package)selectedElement, bWizard.getSelectedBundle());
+ dom.getCommandStack().execute(comd);
+ }
+ }
+
+
+ return null;
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.classpath b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.project b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.project new file mode 100644 index 00000000000..4d8912aebf2 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.adl4eclipsetool</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.settings/org.eclipse.jdt.core.prefs b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/.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.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..ad1ff09d160 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.adl4eclipsetool +Bundle-Version: 0.10.0.qualifier +Bundle-Activator: org.eclipse.papyrus.adltool.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.uml2.uml;bundle-version="4.0.100", + org.eclipse.pde.core, + org.eclipse.papyrus.uml.extensionpoints;bundle-version="0.10.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.0", + org.eclipse.papyrus.adl4eclipse.profile;bundle-version="0.10.0", + org.eclipse.papyrus.osgi.profile;bundle-version="0.10.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.papyrus.adltool.command, + org.eclipse.papyrus.adltool.designer.wizard +Bundle-Localization: plugin +Bundle-Vendor: %providerName +Eclipse-RegisterBuddy: + + + diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/about.html b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/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>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/build.properties b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/build.properties new file mode 100644 index 00000000000..73a5119ed93 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/build.properties @@ -0,0 +1,6 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_obj.gif b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_obj.gif Binary files differnew file mode 100644 index 00000000000..b6096e27c96 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_obj.gif diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_pj.gif b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_pj.gif Binary files differnew file mode 100644 index 00000000000..8493df40dfe --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/bundle_pj.gif diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_obj.gif b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_obj.gif Binary files differnew file mode 100644 index 00000000000..f159bcd92b0 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_obj.gif diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_pj.gif b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_pj.gif Binary files differnew file mode 100644 index 00000000000..8706680c793 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/img/feature_pj.gif diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/plugin.properties b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/plugin.properties new file mode 100644 index 00000000000..18e4eebe362 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/plugin.properties @@ -0,0 +1,12 @@ +################################################################################# +# 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 +################################################################################## +pluginName=ADL4eclipseTool (Incubation) +providerName=Eclipse Modeling Project diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java new file mode 100644 index 00000000000..817231de3dd --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java @@ -0,0 +1,74 @@ +/*****************************************************************************
+ * 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.adltool;
+
+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.adl4eclipsetool"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+ private BundleContext bundleContext;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+
+ /**
+ * @return the bundleContext
+ */
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ this.bundleContext=context;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteArchitectureSnapshotCommand.java new file mode 100644 index 00000000000..c3498b4b0ba --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteArchitectureSnapshotCommand.java @@ -0,0 +1,45 @@ +/*****************************************************************************
+ * 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.adltool.command;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.adltool.designer.CompleteArchitectureSnapshotDesigner;
+import org.eclipse.uml2.uml.Package;
+
+
+/**
+ * this purpose of this comment is to import all the architecture from the currentworkspace
+ *
+ */
+public class CompleteArchitectureSnapshotCommand extends RecordingCommand {
+ protected ArrayList<Object> bundleList=null;
+ protected Package rootPackage;
+
+ public CompleteArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList<Object> bundleList) {
+ super(domain,"Import Bundles", "Model architecture from current workspace");
+ this.rootPackage=rootPackage;
+ this.bundleList=bundleList;
+ }
+
+
+
+ @Override
+ protected void doExecute() {
+ CompleteArchitectureSnapshotDesigner snapshotDesigner= new CompleteArchitectureSnapshotDesigner(rootPackage, bundleList);
+ snapshotDesigner.runImportBundles();
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleArchitectureSnapshotCommand.java new file mode 100644 index 00000000000..4f6c5ed4e0d --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleArchitectureSnapshotCommand.java @@ -0,0 +1,48 @@ +/*****************************************************************************
+ * 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.adltool.command;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.adltool.designer.SimpleArchitectureSnapshotDesigner;
+import org.eclipse.uml2.uml.Package;
+
+
+/**
+ * this purpose of this comment is to import all the architecture from the currentworkspace
+ *
+ */
+public class SimpleArchitectureSnapshotCommand extends RecordingCommand {
+
+ protected Package rootPackage;
+ protected ArrayList<Object> bundleList=null;
+
+ public SimpleArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList<Object> bundleList) {
+ super(domain,"Import Bundles", "Model architecture from current workspace");
+ this.rootPackage=rootPackage;
+ this.bundleList=bundleList;
+ }
+
+
+
+ @Override
+ protected void doExecute() {
+ SimpleArchitectureSnapshotDesigner snapshotDesigner= new SimpleArchitectureSnapshotDesigner(rootPackage, bundleList);
+ snapshotDesigner.runImportBundles();
+ }
+
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java new file mode 100644 index 00000000000..0e5f92292b9 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java @@ -0,0 +1,257 @@ +/*****************************************************************************
+ * 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.adltool.designer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype;
+import org.eclipse.papyrus.adltool.Activator;
+import org.eclipse.papyrus.adltool.designer.bundle.BundleDesignerRegistry;
+import org.eclipse.papyrus.adltool.designer.bundle.ReferencedOSGIElement;
+import org.eclipse.papyrus.osgi.profile.IOSGIStereotype;
+import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
+import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.core.project.IBundleProjectService;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.VersionRange;
+
+
+/**
+ * this purpose of this class is to provide mechanism to import bundle inot model
+ *
+ */
+public abstract class ArchitectureSnapshotDesigner{
+ protected HashMap<String, Component> createdBundleIndex=null;
+ protected HashMap<String, Object> bundlesIndex=null;
+ protected BundleDesignerRegistry bundleDesignerRegistry=null;
+ protected int dependenciesN=0;
+ protected ArrayList<Object>bundleInitialList=null;
+
+
+ /**
+ * The key used to designate the buddy loader associated with a given bundle.
+ */
+
+ protected Package rootPackage;
+
+ public ArchitectureSnapshotDesigner (Package rootPackage) {
+ this.rootPackage=rootPackage;
+ createdBundleIndex= new HashMap<String, Component>();
+ bundleDesignerRegistry= new BundleDesignerRegistry();
+
+ }
+ public ArchitectureSnapshotDesigner (Package rootPackage, ArrayList<Object>bundleInitialList) {
+ this(rootPackage);
+ this.bundleInitialList=bundleInitialList;
+
+ }
+
+
+ public abstract void runImportBundles();
+ /**
+ *
+ * @return bundles loaded in the platform
+ */
+ public static ArrayList<Bundle> getLoadedBundles() {
+ final ArrayList<Bundle> bundlesList = new ArrayList<Bundle>();
+ BundleContext context = Activator.getDefault().getBundleContext();
+ org.osgi.framework.Bundle[] bundles = context.getBundles();
+ for(int i = 0; i < bundles.length; i++) {
+ bundlesList.add(bundles[i]);
+ }
+
+ return bundlesList;
+ }
+
+ /**
+ *
+ * @return the list of bundle description contained in the workspace
+ */
+ public static ArrayList<IBundleProjectDescription>getWorkspaceBundle(){
+ ArrayList<IBundleProjectDescription> bundleProjectList=new ArrayList<IBundleProjectDescription>();
+ IProject[] project=ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ BundleContext context = Activator.getDefault().getBundleContext();
+ ServiceReference<?> ref = context.getServiceReference(IBundleProjectService.class.getName());
+ IBundleProjectService BundleProjectservice = (IBundleProjectService)context.getService(ref);
+ for(int i = 0; i < project.length; i++) {
+ try {
+ if((project[i].getNature(IBundleProjectDescription.PLUGIN_NATURE))!=null){
+ IBundleProjectDescription bundleDescription=BundleProjectservice.getDescription(project[i]);
+ bundleProjectList.add(bundleDescription);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return bundleProjectList;
+ }
+
+
+
+
+
+ /**
+ * model all bundle contained in the workspaces
+ * @param pluginPackage the name of UML package that represent the plugin
+ */
+ protected void modelPlugins(Package pluginPackage){
+ ArrayList<Object> bundleProjects= new ArrayList<Object>();
+ if(bundleInitialList==null){
+ bundleProjects.addAll(getWorkspaceBundle());
+ }
+ else{
+ bundleProjects.addAll(bundleInitialList);
+ }
+ Iterator<Object> bundleProjectsIterator= bundleProjects.iterator();
+ while(bundleProjectsIterator.hasNext()) {
+ Object bundleProject = (Object)bundleProjectsIterator.next();
+ modelPlugin(pluginPackage, bundleProject);
+ }
+ System.out.println("created bundles numbers: "+createdBundleIndex.keySet().size());
+ System.out.println("dependenciess: "+dependenciesN);
+
+ }
+
+
+
+ /**
+ * Model a bundle into the plugins packages:
+ * <UL>
+ * <LI> model the bundle as a stereotyped UML component
+ * <LI>add links to required bundle
+ * <LI> fill information about exported packages
+ * </UL>
+ *
+ *
+ * @param pluginPackage
+ * @param bundleProjectsIterator
+ */
+ protected void modelPlugin(Package pluginPackage, Object bundleProject) {
+
+ if(!createdBundleIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject))){
+ Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
+ System.out.println("-->"+bundleDesignerRegistry.getSymbolicName(bundleProject));
+ bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject));
+ pluginPackage.getPackagedElements().add(bundleComponent);
+ Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
+ bundleComponent.applyStereotype(pluginStereotype);
+ //add in the index of bundles
+ createdBundleIndex.put(bundleDesignerRegistry.getSymbolicName(bundleProject), bundleComponent);
+ fillRequiredBundle(bundleComponent, bundleProject, pluginPackage);
+ bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject);
+ bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject);
+ }
+ }
+
+ /**
+ * Ensure that the profile ADL4 eclipse has been applied
+ */
+ protected void initModel(){
+ RegisteredProfile registeredProfile=RegisteredProfile.getRegisteredProfile("ADL4Eclipse");
+ if(registeredProfile!=null){
+ URI modelUri = registeredProfile.uri;
+ final Resource modelResource = Util.getResourceSet(rootPackage).getResource(modelUri, true);
+ Profile adl4eclipseprofile=(Profile) modelResource.getContents().get(0);
+ PackageUtil.applyProfile(rootPackage, adl4eclipseprofile, false);
+ }
+ }
+
+ protected Object getBundle(String name){
+ if(bundlesIndex==null){
+ bundlesIndex= new HashMap<String, Object>();
+ //loaded bundle
+ BundleContext context = Activator.getDefault().getBundleContext();
+ org.osgi.framework.Bundle[] bundles = context.getBundles();
+ for(int i = 0; i < bundles.length; i++) {
+ bundlesIndex.put(bundleDesignerRegistry.getSymbolicName(bundles[i]), bundles[i]);
+ }
+ IProject[] project=ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ //bundle Workspace
+ ServiceReference<?> ref = context.getServiceReference(IBundleProjectService.class.getName());
+ IBundleProjectService BundleProjectservice = (IBundleProjectService)context.getService(ref);
+ for(int i = 0; i < project.length; i++) {
+ try {
+ if((project[i].getNature(IBundleProjectDescription.PLUGIN_NATURE))!=null){
+ IBundleProjectDescription bundleDescription=BundleProjectservice.getDescription(project[i]);
+ bundlesIndex.put(bundleDesignerRegistry.getSymbolicName(bundleDescription), bundleDescription);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ return bundlesIndex.get(name);
+
+ }
+ /**
+ * Model the required bundle. if it not exist the bundle is modeling.
+ * It create a stereotyped dependency to the required element
+ * @param bundleComponent the description of the bundle
+ * @param bundleProject
+ */
+ protected void fillRequiredBundle(Component bundleComponent,Object bundleProject,Package library ) {
+ ArrayList<ReferencedOSGIElement> requiredBundleNameList=bundleDesignerRegistry.getRequiredBundle(bundleComponent, bundleProject);
+ Iterator<ReferencedOSGIElement> bundleNameIterator= requiredBundleNameList.iterator();
+ while(bundleNameIterator.hasNext()) {
+ dependenciesN++;
+ ReferencedOSGIElement bundleRef = (ReferencedOSGIElement)bundleNameIterator.next();
+ if(!(createdBundleIndex.containsKey(bundleRef.getSymbolicName()))){
+ modelPlugin(library, getBundle(bundleRef.getSymbolicName()));
+ }
+ Component requiredComponent=createdBundleIndex.get(bundleRef.getSymbolicName());
+ Dependency dependency=UMLFactory.eINSTANCE.createDependency();
+ dependency.setName(requiredComponent.getName());
+ bundleComponent.getPackagedElements().add(dependency);
+ dependency.getClients().add(bundleComponent);
+ dependency.getSuppliers().add(requiredComponent);
+ Stereotype bRef_stereotype= dependency.getApplicableStereotype(IOSGIStereotype.BUNDLEREFERENCE_);
+ dependency.applyStereotype(bRef_stereotype);
+ VersionRange versionRange=bundleRef.getVersion();
+ if( versionRange!=null){
+ if( versionRange.getRight()==null){
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, versionRange.getLeft().toString());
+ System.out.println(" "+versionRange.getLeft());
+ }
+ else{
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_FLOOR_ATT, versionRange.getLeft().toString());
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_CEILING_ATT, versionRange.getRight().toString());
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDEFLOOR_ATT, versionRange.getRightType()==VersionRange.LEFT_OPEN);
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDECEILING_ATT, versionRange.getRightType()==VersionRange.RIGHT_OPEN);
+ System.out.println(" "+versionRange.getRight()+" "+versionRange.getLeft());
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java new file mode 100644 index 00000000000..50e1788529f --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java @@ -0,0 +1,44 @@ +/*****************************************************************************
+ * 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.adltool.designer;
+
+import java.util.ArrayList;
+
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * import the list of plugins from all loading plugins
+ *
+ */
+ public class CompleteArchitectureSnapshotDesigner extends ArchitectureSnapshotDesigner {
+
+
+ public CompleteArchitectureSnapshotDesigner(Package rootPackage) {
+ super(rootPackage);
+ }
+
+ public CompleteArchitectureSnapshotDesigner(Package rootPackage, ArrayList<Object>bundleInitialList) {
+ super(rootPackage, bundleInitialList);
+ }
+ @Override
+ protected void initModel() {
+ super.initModel();
+ }
+
+ @Override
+ public void runImportBundles() {
+ initModel();
+ modelPlugins(rootPackage);
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java new file mode 100644 index 00000000000..9a9182d698d --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java @@ -0,0 +1,61 @@ +/*****************************************************************************
+ * 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.adltool.designer;
+
+import java.util.ArrayList;
+
+import org.eclipse.uml2.uml.Package;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * this architecture designer is used to construct the structure from workspace
+ *
+ */
+public class SimpleArchitectureSnapshotDesigner extends ArchitectureSnapshotDesigner {
+
+ protected Package architecture;
+ protected Package platform;
+ public SimpleArchitectureSnapshotDesigner(Package rootPackage) {
+ super(rootPackage);
+ }
+
+
+ public SimpleArchitectureSnapshotDesigner(Package rootPackage, ArrayList<Object>bundleInitialList) {
+ super(rootPackage, bundleInitialList);
+ }
+
+ @Override
+ protected void initModel() {
+ super.initModel();
+ architecture=rootPackage.createNestedPackage("Architecture");
+ platform=rootPackage.createNestedPackage("Platform");
+ }
+
+ @Override
+ public void runImportBundles() {
+ initModel();
+ modelPlugins(architecture);
+ }
+
+ @Override
+ protected void modelPlugin(Package pluginPackage, Object bundleProject) {
+ if (bundleProject instanceof Bundle){
+ super.modelPlugin(platform, bundleProject);
+ }
+ else{
+ super.modelPlugin(architecture, bundleProject);
+ }
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java new file mode 100644 index 00000000000..6a35616e7c4 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java @@ -0,0 +1,187 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import java.util.ArrayList;
+
+import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype;
+import org.eclipse.papyrus.osgi.profile.IOSGIStereotype;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Stereotype;
+import org.osgi.framework.Constants;
+
+
+public abstract class AbstractBundleDescriptionDesigner implements IBundleDescriptionDesigner {
+ /**
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getBundleValue(java.lang.Object, java.lang.String)
+ *
+ * @param bundleProject
+ * @param key
+ * @return
+ */
+
+ public abstract String getBundleValue( Object bundleProject, String key);
+
+ /**
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#fillPluginProperties(org.eclipse.uml2.uml.Component, org.osgi.framework.Bundle)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ */
+
+ public void fillPluginProperties(Component bundleComponent,Object bundleProject ){
+ Stereotype pluginStereotype= bundleComponent.getAppliedStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
+ //bundleProject.getHeader(Constants.BUNDLE_ACTIVATIONPOLICY);
+ String activationPolicy=getBundleValue( bundleProject, Constants.BUNDLE_ACTIVATIONPOLICY);
+ if("lazy".equals(activationPolicy)){
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_HASLAZYACTIVATIONPOLICY_ATT, true);
+ }
+ else if(activationPolicy==null){
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_HASLAZYACTIVATIONPOLICY_ATT, null);
+ }
+ else{
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_HASLAZYACTIVATIONPOLICY_ATT, null);
+ }
+
+ //Constants.BUNDLE_ACTIVATOR;
+ String activator=getBundleValue( bundleProject, Constants.BUNDLE_ACTIVATOR);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_ACTIVATOR_ATT, activator);
+ // BUNDLE_CATEGORY
+ String category=getBundleValue( bundleProject, Constants.BUNDLE_CATEGORY);
+ if(category==null){
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_CATEGORY_ATT, category);
+ }
+ //Constants.BUNDLE_CLASSPATH
+ String class_path=getBundleValue( bundleProject, Constants.BUNDLE_CLASSPATH);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_CLASSPATH_ATT, class_path);
+
+ //Constants.BUNDLE_CONTACTADDRESS
+ String contactAdress=getBundleValue( bundleProject, Constants.BUNDLE_CONTACTADDRESS);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_CONTACTADDRESS_ATT, contactAdress);
+
+ // Constants.BUNDLE_COPYRIGHT
+ String copyright=getBundleValue( bundleProject, Constants.BUNDLE_COPYRIGHT);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_COPYRIGHT_ATT, copyright);
+ //BUNDLE_DESCRIPTION
+ String description=getBundleValue( bundleProject, Constants.BUNDLE_DESCRIPTION);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_DESCRIPTION_ATT, description);
+
+ //BUNDLE_DOCURL
+ String docurl=getBundleValue( bundleProject, Constants.BUNDLE_DOCURL);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_DOCURL_ATT, docurl);
+
+ //BUNDLE_LOCALIZATION
+ String localization=getBundleValue( bundleProject, Constants.BUNDLE_LOCALIZATION);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_LOCALIZATION_ATT, localization);
+ //Constants.BUNDLE_MANIFESTVERSION
+ String manisfestVerion=getBundleValue( bundleProject, Constants.BUNDLE_MANIFESTVERSION);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_NAME_ATT, manisfestVerion);
+ //BUNDLE_NAME
+ String name=getBundleValue( bundleProject, Constants.BUNDLE_NAME);
+ //String buddypolicy=getBundleValue( bundleProject, BUDDY_LOADER);
+ if (name!=null && name.toLowerCase().contains("incubation")){
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_ISINCUBATION_ATT, true);}
+ else{
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_ISINCUBATION_ATT, false);
+ }
+
+ name=name.replace("(Incubation)", "");
+ name=name.replace("(incubation)", "");
+ name=name.replace("Incubation", "");
+ name=name.replace("incubation", "");
+
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_NAME_ATT, name.trim());
+ //BUNDLE_NATIVECODE
+ String nativeCode=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_NATIVECODE_ATT, nativeCode);
+ // String nativeCodeLanguage=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE_LANGUAGE);
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE_OSNAME);
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE_OSVERSION);
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE_PROCESSOR);
+
+ //BUNDLE_REQUIREDEXECUTIONENVIRONMENT
+ String requiredExecutionEnv=getBundleValue( bundleProject, Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_REQUIREDEXECUTIONENVIRONMENT_ATT, requiredExecutionEnv);
+ //BUNDLE_SYMBOLICNAME
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_SYMBOLICNAME_ATT,getSymbolicName(bundleProject));
+
+ //Constants.BUNDLE_UPDATELOCATION
+ String updateLocation=getBundleValue( bundleProject, Constants.BUNDLE_UPDATELOCATION);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_UPDATELOCATION_ATT, updateLocation);
+
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_VENDOR);
+ String vendor=getBundleValue( bundleProject, Constants.BUNDLE_VENDOR);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_VENDOR_ATT, vendor);
+
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_VERSION);
+ String version=getBundleValue( bundleProject, Constants.BUNDLE_VERSION);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_VERSION_ATT, version);
+ //String activator=getBundleValue( bundleProject, Constants.BUNDLE_VERSION_ATTRIBUTE);
+
+ //PLUGIN ATTRIBUTE
+ //http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fbundle_manifest.html
+ //Eclipse-LazyStart ::= ( 'true' | 'false' ) ( ';' 'exceptions' '=' '"' exceptions-list '"' ) ?
+ // exceptions-list ::= a comma ',' separated list of packages
+ String lazystartExpression=getBundleValue( bundleProject, ECLIPSE_LAZYSTART);
+ if (lazystartExpression!=null){
+ boolean lazyStartValue;
+ if( lazystartExpression.contains(";")){
+ String lazyStartString= lazystartExpression.substring(0, lazystartExpression.indexOf(";"));
+ lazyStartValue= Boolean.valueOf(lazyStartString);
+ String lazyStartException= lazystartExpression.substring(lazystartExpression.indexOf(";"));
+ //TODO: lazystartExpression
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT,lazyStartException );
+ }
+ else{
+ lazyStartValue= Boolean.valueOf(lazystartExpression);
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTART_ATT,lazyStartValue );
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT,new ArrayList() );
+ }
+ }else{
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTART_ATT,null );
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT, new ArrayList() );
+ }
+
+
+
+ //IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT
+ String buddypolicy=getBundleValue( bundleProject, ECLIPSE_BUDDY_LOADER);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_BUNDLESHAPE_ATT
+ String bundleShape=getBundleValue( bundleProject, ECLIPSE_BUNDLE_SHAPE);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_CAPABILITY_ATT
+ String capability=getBundleValue( bundleProject, ECLIPSE_GENERICCAPABILITY);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_CAPABILITY_ATT, capability);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_EXTENSIBLEAPI_ATT
+ //String buddypolicy=getBundleValue( bundleProject, BUDDY_LOADER);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_GENERICCAPABILITYALIAS_ATT
+ //String capabilityAlias=getBundleValue( bundleProject, ECLIPSE_GENERICCAPABILITY);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_ISINCUBATION_ATT
+
+ //IADL4ECLIPSE_Stereotype.PLUGIN_PLATFORMFILTER_ATT
+ String platformFilter=getBundleValue( bundleProject, ECLIPSE_PLATFORMFILTER);
+ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_PLATFORMFILTER_ATT, platformFilter);
+ //IADL4ECLIPSE_Stereotype.PLUGIN_REQUIRECAPABILITY_ATT
+ //String buddypolicy=getBundleValue( bundleProject, ECLIPSE_);
+ //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy);
+
+
+ }
+
+
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java new file mode 100644 index 00000000000..dd90bb9d1d6 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java @@ -0,0 +1,126 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import java.util.ArrayList;
+
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.uml2.uml.Component;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * this registry redirect the job to a good implementation.
+ *
+ */
+public class BundleDesignerRegistry implements IBundleDescriptionDesigner{
+ protected WorkspaceBundleDescriptionDesigner workspaceBundleDescriptionDesigner;
+ protected LoadedBundleDescriptionDesigner loadedBundleDescriptionDesigner;
+
+
+ public BundleDesignerRegistry() {
+ workspaceBundleDescriptionDesigner= new WorkspaceBundleDescriptionDesigner();
+ loadedBundleDescriptionDesigner= new LoadedBundleDescriptionDesigner();
+ }
+
+/**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getBundleValue(java.lang.Object, java.lang.String)
+ *
+ * @param bundleProject
+ * @param key
+ * @return
+ */
+ public String getBundleValue(Object bundleProject, String key) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return workspaceBundleDescriptionDesigner.getBundleValue(bundleProject, key);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ return loadedBundleDescriptionDesigner.getBundleValue(bundleProject, key);
+ }
+ return null;
+ }
+
+/**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#fillPluginProperties(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ */
+ public void fillPluginProperties(Component bundleComponent, Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ workspaceBundleDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ loadedBundleDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject);
+ }
+ }
+
+/**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getSymbolicName(java.lang.Object)
+ *
+ * @param bundleProject
+ * @return
+ */
+ public String getSymbolicName(Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return workspaceBundleDescriptionDesigner.getSymbolicName(bundleProject);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ return loadedBundleDescriptionDesigner.getSymbolicName(bundleProject);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#fillExportedPackages(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ */
+ public void fillExportedPackages(Component bundleComponent, Object bundleProject ) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ workspaceBundleDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ loadedBundleDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject);
+ }
+
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getRequiredBundle(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ * @return
+ */
+ public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return workspaceBundleDescriptionDesigner.getRequiredBundle(bundleComponent, bundleProject);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ return loadedBundleDescriptionDesigner.getRequiredBundle(bundleComponent, bundleProject);
+ }
+ return new ArrayList<ReferencedOSGIElement>();
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java new file mode 100644 index 00000000000..a5d36452bce --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java @@ -0,0 +1,68 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+
+
+public class BundleLabelProvider extends LabelProvider {
+ BundleDesignerRegistry bundleDesignerRegistry;
+
+ public BundleLabelProvider() {
+ bundleDesignerRegistry= new BundleDesignerRegistry();
+ }
+
+ public Image getImage(Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return getImage("img/bundle_pj.gif");
+
+ }
+ else if(bundleProject instanceof Bundle){
+ return getImage("img/bundle_obj.gif");
+ }
+ return super.getImage(bundleProject);
+ }
+
+ @Override
+ public String getText(Object element) {
+ return bundleDesignerRegistry.getSymbolicName(element);
+ }
+
+ /**
+ * Returns an {@link org.eclipse.swt.graphics.Image} identified by its key.<BR>
+ * By default, it returns a default image. This image is the image placed in the directory <em>resources/icons/default.gif</em>
+ *
+ * @param key
+ * the key of the image
+ *
+ * @return the Image
+ */
+ public static Image getImage(String key) {
+ ImageRegistry registry = org.eclipse.papyrus.adltool.Activator.getDefault().getImageRegistry();
+ Image image = registry.get(key);
+ if(image == null) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(org.eclipse.papyrus.adltool.Activator.PLUGIN_ID, key);
+ registry.put(key, desc);
+ image = registry.get(key);
+ }
+
+ return image;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java new file mode 100644 index 00000000000..677e9eb3f72 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java @@ -0,0 +1,68 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import java.util.ArrayList;
+
+import org.eclipse.uml2.uml.Component;
+
+/**
+ * this class is used to construct bundle from JAVA object (Bundle or IBundleProjectDescription)
+ *
+ */
+public interface IBundleDescriptionDesigner {
+
+ public final static String ECLIPSE_BUDDY_LOADER = "Eclipse-BuddyPolicy"; //$NON-NLS-1$
+
+ public final static String ECLIPSE_BUNDLE_SHAPE = "Eclipse-BundleShape";
+
+ public final static String ECLIPSE_GENERICCAPABILITY = "Eclipse-GenericCapability";
+
+ public final static String ECLIPSE_GENERICREQUIRE = "Eclipse-GenericRequire";
+
+ public final static String ECLIPSE_LAZYSTART = "Eclipse-LazyStart";
+
+ public final static String ECLIPSE_PLATFORMFILTER = "Eclipse-PlatformFilter";
+
+ public final static String ECLIPSE_REGISTERBUDDY = "Eclipse-RegisterBuddy";
+
+ public String getBundleValue(Object bundleProject, String key);
+
+ /**
+ * fill properties of stereotypes from Meta-information of the JAVA bundle object
+ * @param bundleComponent the UML representation of a bundle
+ * @param bundleProject the JAVA bundle project
+ */
+ public void fillPluginProperties(Component bundleComponent, Object bundleProject);
+ /**
+ * get the symbolic name from the JAVA object that represent the bundle
+ * @param bundleProject
+ * @return the symbolic name
+ */
+ public String getSymbolicName(Object bundleProject);
+
+ /**
+ * create packages that are exported to other plugins
+ * @param bundleComponent the UML representation of the bundle
+ * @param bundleProject the bundle JAVA object
+ */
+ public void fillExportedPackages(Component bundleComponent, Object bundleProject);
+ /**
+ * return the list of referenced OSGI element from a bundle
+ * @param bundleComponent the UML component that represent the bundle
+ * @param bundleProject the java class that represent the bundle
+ * @return the list of OSGI references
+ */
+ public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject);
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java new file mode 100644 index 00000000000..09c2256c8d2 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java @@ -0,0 +1,145 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype;
+import org.eclipse.papyrus.osgi.profile.IOSGIStereotype;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.core.project.IPackageExportDescription;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.VersionRange;
+
+/**
+ * this class is an implementation for Bundle element -JAVA object of loaded bundle in the platform
+ *
+ */
+public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDesigner {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.AbstractBundleDescriptionDesigner#getBundleValue(java.lang.Object, java.lang.String)
+ *
+ * @param bundleProject
+ * @param key
+ * @return
+ */
+ public String getBundleValue(Object bundleProject, String key) {
+ if(bundleProject instanceof Bundle){
+ return ((Bundle)bundleProject).getHeaders().get(key);
+ }
+ return null;
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#fillExportedPackages(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ */
+ public void fillExportedPackages(Component bundleComponent, Object bundleProject ) {
+ if(bundleProject instanceof Bundle){
+ ArrayList<EObject> exportedPackages= new ArrayList<EObject>();
+ String exportPackageString=getBundleValue( bundleProject, Constants.EXPORT_PACKAGE);
+ try {
+ ManifestElement[] manisfests=ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, exportPackageString);
+ if(manisfests!=null){
+ for(int i = 0; i < manisfests.length; i++) {
+ ReferencedOSGIElement newRefElement= new ReferencedOSGIElement(null,manisfests[i].getValue());
+ Package UMLPackage=UMLFactory.eINSTANCE.createPackage();
+ UMLPackage.setName(manisfests[i].getValue());
+ bundleComponent.getPackagedElements().add(UMLPackage);
+
+ Stereotype exportedPackageStereotype=UMLPackage.getApplicableStereotype(IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_);
+ UMLPackage.applyStereotype(exportedPackageStereotype);
+ if((manisfests[i].getDirective("x-internal"))!=null){
+ String booleanString=(manisfests[i].getDirective("x-internal"));
+ boolean value=Boolean.parseBoolean(booleanString);
+ UMLPackage.setValue(exportedPackageStereotype, IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_ISINTERNAL_ATT,value);
+ }
+ if((manisfests[i].getDirective("x-friends"))!=null){
+ //TODO: xfriends
+ }
+
+ if( manisfests[i].getAttribute("version")!=null){
+ VersionRange version= new VersionRange( manisfests[i].getAttribute("version"));
+ newRefElement.setVersion(version);
+ UMLPackage.setValue(exportedPackageStereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, version.toString());
+
+ }
+ exportedPackages.add(UMLPackage.getStereotypeApplication(exportedPackageStereotype));
+ }
+ Stereotype pluginStereotype=bundleComponent.getAppliedStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_EXPORTPACKAGE_ATT, exportedPackages);
+ }
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getRequiredBundle(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ * @return
+ */
+ public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject) {
+ ArrayList<ReferencedOSGIElement> bundleListName=new ArrayList<ReferencedOSGIElement>();
+ String requiredbundleString=getBundleValue( bundleProject, Constants.REQUIRE_BUNDLE);
+ try {
+ ManifestElement[] manisfests=ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, requiredbundleString);
+ if(manisfests!=null){
+ for(int i = 0; i < manisfests.length; i++) {
+ ReferencedOSGIElement newRefElement= new ReferencedOSGIElement(null,manisfests[i].getValue());
+ if( manisfests[i].getAttribute(Constants.BUNDLE_VERSION.toLowerCase())!=null){
+ VersionRange version= new VersionRange( manisfests[i].getAttribute(Constants.BUNDLE_VERSION.toLowerCase()));
+ newRefElement.setVersion(version);
+ }
+ bundleListName.add(newRefElement);
+
+ }
+ }
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+
+ return bundleListName;
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getSymbolicName(java.lang.Object)
+ *
+ * @param bundleProject
+ * @return
+ */
+ public String getSymbolicName(Object bundleProject) {
+
+ if(bundleProject instanceof Bundle){
+ return ((Bundle)bundleProject).getSymbolicName();
+ }
+ return null;
+
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java new file mode 100644 index 00000000000..38eec1e5c32 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java @@ -0,0 +1,68 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import org.osgi.framework.VersionRange;
+
+/**
+ * this class is an abstraction of a reference to an element
+ * it name + version
+ *
+ */
+public class ReferencedOSGIElement {
+
+ private VersionRange version=null;
+ private String symbolicName= null;
+
+ /**
+ * Constructor.
+ *
+ * @param version
+ * @param symbolicName
+ */
+ public ReferencedOSGIElement(VersionRange version, String symbolicName) {
+ super();
+ this.version = version;
+ this.symbolicName = symbolicName;
+ }
+
+ /**
+ * @return the version
+ */
+ public VersionRange getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version the version to set
+ */
+ public void setVersion(VersionRange version) {
+ this.version = version;
+ }
+
+ /**
+ * @return the symbolicName
+ */
+ public String getSymbolicName() {
+ return symbolicName;
+ }
+
+ /**
+ * @param symbolicName the symbolicName to set
+ */
+ public void setSymbolicName(String symbolicName) {
+ this.symbolicName = symbolicName;
+ }
+
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java new file mode 100644 index 00000000000..fc592b963b1 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java @@ -0,0 +1,124 @@ +/*****************************************************************************
+ * 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.adltool.designer.bundle;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.PropertyResourceBundle;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype;
+import org.eclipse.papyrus.osgi.profile.IOSGIStereotype;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.core.project.IPackageExportDescription;
+import org.eclipse.pde.core.project.IRequiredBundleDescription;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.osgi.framework.Constants;
+
+
+
+public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptionDesigner {
+
+ public String getBundleValue(Object bundleProject, String key){
+ String valueFromDescription=null;
+ if(bundleProject instanceof IBundleProjectDescription){
+ PropertyResourceBundle propertyResourceBundle=getNLSFilesFor((IBundleProjectDescription)bundleProject);
+ valueFromDescription=((IBundleProjectDescription)bundleProject).getHeader(key);
+ if( propertyResourceBundle!=null&&valueFromDescription!=null ){
+ if (valueFromDescription.startsWith("%") && (valueFromDescription.length() > 1)) { //$NON-NLS-1$
+ String propertiesKey = valueFromDescription.substring(1);
+ valueFromDescription = propertyResourceBundle.getString(propertiesKey);
+ }
+ }
+ }
+ return valueFromDescription;
+ }
+
+ /**
+ * get properties files
+ * @param bundle the bundle description
+ * @return the bundle properties if it exist form Bundle description
+ */
+ protected static PropertyResourceBundle getNLSFilesFor(IBundleProjectDescription bundle) {
+ PropertyResourceBundle bundleproperties=null;
+ // get the base localization path from the target
+ String localization = (String) bundle.getHeader(Constants.BUNDLE_LOCALIZATION);
+ if (localization != null){
+ // we do a simple check to make sure the default nls path exists in the target;
+ // this is for performance reasons, but I'm not sure it is valid because a target could ship without the default nls properties file but this seems very unlikely
+ IFile file=bundle.getProject().getFile(localization + ".properties");
+ if( file!=null){
+ try {
+ bundleproperties= new PropertyResourceBundle(file.getContents());
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return bundleproperties;
+ }
+ /**
+ * create package from exported Packages
+ * @param bundleComponent the description of the bundle
+ * @param bundleProject
+ */
+ public void fillExportedPackages(Component bundleComponent, Object bundleProject ) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ IPackageExportDescription[] packageExportDescription=((IBundleProjectDescription)bundleProject).getPackageExports();
+ if(packageExportDescription!=null){
+ ArrayList<EObject> exportedPackages= new ArrayList<EObject>();
+ for(int i = 0; i < packageExportDescription.length; i++) {
+ Package UMLPackage=UMLFactory.eINSTANCE.createPackage();
+ UMLPackage.setName(packageExportDescription[i].getName());
+ bundleComponent.getPackagedElements().add(UMLPackage);
+ Stereotype exportedPackageStereotype=UMLPackage.getApplicableStereotype(IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_);
+ UMLPackage.applyStereotype(exportedPackageStereotype);
+ UMLPackage.setValue(exportedPackageStereotype, IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_ISINTERNAL_ATT, !packageExportDescription[i].isApi());
+ //TODO:friends
+ if(packageExportDescription[i].getVersion()!=null){
+ UMLPackage.setValue(exportedPackageStereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, packageExportDescription[i].getVersion().toString());
+ }
+ exportedPackages.add(UMLPackage.getStereotypeApplication(exportedPackageStereotype));
+ }
+ Stereotype pluginStereotype=bundleComponent.getAppliedStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
+ bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_EXPORTPACKAGE_ATT, exportedPackages);
+ }
+ }
+ }
+
+ public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject) {
+ ArrayList<ReferencedOSGIElement> bundleRefList=new ArrayList<ReferencedOSGIElement>();
+ if(bundleProject instanceof IBundleProjectDescription){
+ IRequiredBundleDescription[] requiredBundleDescriptions=((IBundleProjectDescription)bundleProject).getRequiredBundles();
+ for(int i = 0; i < requiredBundleDescriptions.length; i++) {
+ ReferencedOSGIElement newrefElement= new ReferencedOSGIElement(null,requiredBundleDescriptions[i].getName());
+ bundleRefList.add(newrefElement);
+ }
+ }
+ return bundleRefList;
+ }
+ public String getSymbolicName(Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return ((IBundleProjectDescription) bundleProject).getSymbolicName();
+ }
+ return null;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleArchitectureWizard.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleArchitectureWizard.java new file mode 100644 index 00000000000..0582ae0048e --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleArchitectureWizard.java @@ -0,0 +1,59 @@ +/*****************************************************************************
+ * 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.adltool.designer.wizard;
+
+
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.papyrus.adltool.designer.ArchitectureSnapshotDesigner;
+
+
+
+public class BundleArchitectureWizard extends Wizard {
+
+ protected BundleSelectionPage bundleSelectionPage;
+ protected boolean onlyWorkspace=true;
+
+ public BundleArchitectureWizard(boolean onlyWorkspace) {
+ super();
+ setNeedsProgressMonitor(true);
+ this.onlyWorkspace=onlyWorkspace;
+ }
+
+ @Override
+ public void addPages() {
+ ArrayList<Object> bundleList= new ArrayList<Object>();
+ bundleList.addAll(ArchitectureSnapshotDesigner.getWorkspaceBundle());
+ //do not look for loaded plugin in the case of a simple research
+ if(!onlyWorkspace){
+ bundleList.addAll(ArchitectureSnapshotDesigner.getLoadedBundles());
+ }
+ bundleSelectionPage = new BundleSelectionPage(bundleList);
+ addPage(bundleSelectionPage);
+ }
+
+ public ArrayList<Object> getSelectedBundle(){
+ return bundleSelectionPage.getResult();
+ }
+ @Override
+ public boolean performFinish() {
+ if(bundleSelectionPage.getResult().size()>0){
+
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java new file mode 100644 index 00000000000..5ea8111a044 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java @@ -0,0 +1,112 @@ +
+/*****************************************************************************
+ * 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.adltool.designer.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.adltool.designer.bundle.BundleLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+
+public class BundleSelectionPage extends WizardPage {
+ /**
+ * the graphical tree
+ */
+ protected Tree elementTree;
+ protected ArrayList<?> bundleList;
+ protected ArrayList<Object> selectedBundleList;
+ protected BundleLabelProvider bundleLabelProvider= new BundleLabelProvider();
+
+ private Composite comp;
+
+ public BundleSelectionPage(ArrayList<?> bundleList) {
+ super("BundleSelection");
+ setTitle("Bundle Selection");
+ setDescription("Select bundles to create the architecture model.");
+ this.bundleList=bundleList;
+ this.selectedBundleList= new ArrayList<Object>();
+ }
+
+ public void createControl(Composite parent) {
+ comp = new Composite(parent, SWT.NULL);
+ FillLayout layout = new FillLayout();
+ comp.setLayout(layout);
+ elementTree = new Tree(comp, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL);
+
+ if(bundleList != null) {
+
+ Iterator<?> it = bundleList.iterator();
+ while(it.hasNext()) {
+ Object current = it.next();
+ createTreeItem(current);
+ }
+ }
+
+ elementTree.addListener(SWT.Selection, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(event.detail == SWT.CHECK) {
+ if(selectedBundleList.contains(event.item.getData())) {
+ selectedBundleList.remove(event.item.getData());
+
+ } else {
+ selectedBundleList.add(event.item.getData());
+ }
+ if(selectedBundleList.size()>0){
+ setPageComplete(true);
+ }
+ else{
+ setPageComplete(false);
+ }
+ }
+ }
+ });
+ comp.pack();
+ setControl(comp);
+ setPageComplete(false);
+
+
+ }
+
+
+ /**
+ * create an item that represent the bundle
+ * @param _package
+ */
+ private void createTreeItem(Object bundle) {
+ TreeItem item = new TreeItem(elementTree, SWT.NONE);
+ item.setText(bundleLabelProvider.getText(bundle));
+ item.setImage(bundleLabelProvider.getImage(bundle));
+ item.setData(bundle);
+ }
+
+ /**
+ * Returns the elements to import.
+ *
+ * @return
+ */
+ public ArrayList<Object> getResult() {
+ return selectedBundleList;
+ }
+
+}
|